This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "mocha_assert", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "mocha index.test.js" | |
| }, | |
| "keywords": [], | |
| "author": "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("The Test Group", () => { | |
| it("the title of the test", () => { | |
| // the test code is here | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // index.test.js | |
| const assert = require("assert"); | |
| const StudentManagement = require("./index"); | |
| describe("Student Management Module", () => { | |
| let testClass; | |
| before(() => { | |
| testClass = new StudentManagement(["Abel", "Ben", "Cain"]); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npx mocha index.test.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //. | |
| "scripts": { | |
| "test": "mocha index.test.js" | |
| }, | |
| //.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm install mocha --save-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // demo.js | |
| const StudentManagement = require("./index") | |
| const classA = new StudentManagement(["Abel", "Ben", "Cain"]) | |
| console.log("Intial Students: \n", classA.getStudent()) | |
| // adding two new students | |
| classA.add("Daniel", "Evelyn") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // index.js | |
| let counter = 0; | |
| const generateId = () => { | |
| ++counter; | |
| return counter; | |
| }; | |
| class StudentManagement { | |
| #students = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // index.test.js | |
| const assert = require("assert") | |
| const StudentManagement = require("./index") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // index.js | |
| let counter = 0; | |
| const generateId = () => {/* */}; | |
| class StudentManagement { | |
| constructor() {/* */} | |
| add() {/* */} |