UNPKG

@omegabigdata/honoplay-api-helper-node

Version:
80 lines (67 loc) 2.45 kB
const should = require("should"); const sinon = require("sinon"); const app = require("../index").Option; describe("# Option", () => { describe("- Put Option", () => { it("should Put Option Option Model mandatory", () => { should(() => app.putOption()).throwError("Missing Parameters"); }); it("should method called success callback", () => { let success = sinon.spy(); app.putOption({}, success, () => {}); should(success.called).be.true; }); it("should method called error callback when throw error", () => { let error = sinon.spy(); app.putOption({}, () => {}, error); should(error.called).be.true; }); }); describe("- Post Option", () => { it("should Post Option Option Model mandatory", () => { should(() => app.postOption()).throwError("Missing Parameters"); }); it("should method called success callback", () => { let success = sinon.spy(); app.postOption({}, success, () => {}); should(success.called).be.true; }); it("should method called error callback when throw error", () => { let error = sinon.spy(); app.postOption({}, () => {}, error); should(error.called).be.true; }); }); describe("- Get Options", () => { it("should getOptions skip and take positive numbers", () => { should(() => app.getOptions(-1, -1)).throwError( "Values must be positive" ); }); it("should method called success callback", () => { let success = sinon.spy(); app.getOptions(1, 1, success, () => {}); should(success.called).be.true; }); it("should method called error callback when throw error", () => { let error = sinon.spy(); app.getOptions(5, 5, () => {}, error); should(error.called).be.true; }); }); describe("- Get Option", () => { it("should getOption must not null ", () => { should(() => app.getOption()).throwError("Missing Parameters"); }); it("should method called success callback", () => { let success = sinon.spy(); app.getOption(1, success, () => {}); should(success.called).be.true; }); it("should method called error callback when throw error", () => { let error = sinon.spy(); app.getOption(5, () => {}, error); should(error.called).be.true; }); }); });