UNPKG

@omegabigdata/honoplay-api-helper-node

Version:
50 lines (42 loc) 1.56 kB
const should = require("should"); const sinon = require("sinon"); const app = require("../index").Department; describe("#DepartmentTest", () => { describe("- postDepartments", () => { it("should Post Departments department Model mandatory", () => { should(() => app.postDepartment()).throwError("Missing Parameters"); }); it("should method called success callback", () => { let success = sinon.spy(); app.postDepartment({}, success, () => {}); should(success.called).be.true; }); it("should method called error callback when throw error", () => { let error = sinon.spy(); app.postDepartment({}, () => {}, error); should(error.called).be.true; }); }); describe("- getDepartments", () => { it("should getDepartments skip and take positive numbers", () => { should(() => app.getDepartments(-1, -1)).throwError( "Values must be positive" ); }); it("should getDepartments skip and take numeric", () => { should(() => app.getDepartments("a", "b")).throwError( "Values must be numeric" ); }); it("should method called success callback", () => { let success = sinon.spy(); app.getDepartments(1, 1, success, () => {}); should(success.called).be.true; }); it("should method called error callback when throw error", () => { let error = sinon.spy(); app.getDepartments(50, 50, () => {}, error); should(error.called).be.true; }); }); });