You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importTomfrom'test-object-model'import'https://www.chaijs.com/chai.js'constassert=chai.assertconsttom=newTom()tom.test('Math.random() should return a number between 0 and 1',function(){constresult=Math.random()assert.equal(typeofresult,'number')assert.ok(result>=0&&result<=1)})tom.test('REST API should return the current todo item',asyncfunction(){constresponse=awaitfetch('https://jsonplaceholder.typicode.com/todos/1')consttodo=awaitresponse.json()assert.equal(todo.userId,1)assert.equal(todo.title,'delectus aut autem')})exportdefaulttom
Run the tests using web-runner. This runner is identical to test-runner with the one difference that it runs the tests in Chromium rather than Node.js.
$ npx web-runner test.mjs
Start: 2 tests loaded
✓ synopsis Math.random() should return a number between 0 and 1
✓ synopsis REST API should return the current todo item
Completed in 199ms. Pass: 2, fail: 0, skip: 0.