@omegabigdata/honoplay-api-helper-node
Version:
44 lines (37 loc) • 1.38 kB
JavaScript
const should = require("should");
const sinon = require("sinon");
const app = require("../index").Profession;
describe("#Profession Test", () => {
describe("- Get Professions", () => {
it("should getProfession skip and take positive numbers", () => {
should(() => app.getProfessions(-1, -1)).throwError(
"Values must be positive"
);
});
it("should method called success callback", () => {
let success = sinon.spy();
app.getProfessions(1, 1, success, () => {});
should(success.called).be.true;
});
it("should method called error callback when throw error", () => {
let error = sinon.spy();
app.getProfessions(5, 5, () => {}, error);
should(error.called).be.true;
});
});
describe("- Post Profession", () => {
it("should Post Profession profession Model mandatory", () => {
should(() => app.postProfession()).throwError("Missing Parameters");
});
it("should method called success callback", () => {
let success = sinon.spy();
app.postProfession({}, success, () => {});
should(success.called).be.true;
});
it("should method called error callback when throw error", () => {
let error = sinon.spy();
app.postProfession({}, () => {}, error);
should(error.called).be.true;
});
});
});