Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const assert = require('assert');
- const chai = require('chai');
- // use the expect assertion style from the chai module
- const expect = chai.expect;
- // start our app
- const app = require('../app');
- // make sure our test framework Mocha is working as expected
- // describe is used to group unit tests that are related to each other under one test suite
- describe('Array', ()=>{
- describe('indexOf()', ()=>{
- // 'it' is a single unit test
- it('should return -1 when the given value is not in the array',()=>{
- // in a unit test, assertions will be written to tell Mocha what should happen in order for the test to pass
- assert.equal([1,2,3].indexOf(4), -1 )
- });
- });
- });
- // test the existence of our application
- describe('App',()=>{
- it('should exist', ()=>{
- expect(app).to.be.a('function');
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement