unit Test
코드검사
- 동료검토
- Code linter
- 코드검사(Code Coverage)
- run ./test/*.jsmocha before each
1var module = require("../module");23var chai = require("chai");4var expect = char.expect;56describe("module", function () {7it("test name 1", function () {8expect(module("variables1", ...)).to.equal("expectedValue1");9...10});11it("test name 2", function () {12expect(module("variables2", ...)).to.euqal("expectedValue2");13...14});15...16});error test1describe("User", function () {2var user;3beforeEach(function () {4user = new User({5firstName: "fname",6lastName: "lname"7});8});910it("something", function () {11expect(user.getName()).to.equal("fname lname");12});13//...14})not1//...2it("throws an error", function() {3expect(function() { capitalize(123); }).to.throw(Error);4});5//...1//...2if("changes the value", function () {3expect(capitalize("foo")).not.to.expect("foo");4});5//...EndPoint Test