Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. const assert = require('assert');
  2. const chai = require('chai');
  3.  
  4. // use the expect assertion style from the chai module
  5. const expect = chai.expect;
  6.  
  7. // start our app
  8. const app = require('../app');
  9.  
  10. // make sure our test framework Mocha is working as expected
  11. // describe is used to group unit tests that are related to each other under one test suite
  12.  
  13. describe('Array', ()=>{
  14. describe('indexOf()', ()=>{
  15. // 'it' is a single unit test
  16. it('should return -1 when the given value is not in the array',()=>{
  17. // in a unit test, assertions will be written to tell Mocha what should happen in order for the test to pass
  18.  
  19. assert.equal([1,2,3].indexOf(4), -1 )
  20.  
  21. });
  22. });
  23. });
  24.  
  25. // test the existence of our application
  26. describe('App',()=>{
  27. it('should exist', ()=>{
  28. expect(app).to.be.a('function');
  29. });
  30. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement