Add tests for alert.js
This commit is contained in:
parent
74f63135e9
commit
4cd0bcff05
32
frontend/tests/unit/common/alert_test.js
Normal file
32
frontend/tests/unit/common/alert_test.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import Alert from "common/alert";
|
||||||
|
let sinon = require("sinon");
|
||||||
|
|
||||||
|
describe("common/alert", () => {
|
||||||
|
it("should call alert.info", () => {
|
||||||
|
let spy = sinon.spy(Alert, "info");
|
||||||
|
Alert.info("message");
|
||||||
|
sinon.assert.calledOnce(spy);
|
||||||
|
spy.resetHistory();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should call alert.warning", () => {
|
||||||
|
let spy = sinon.spy(Alert, "warning");
|
||||||
|
Alert.warning("message");
|
||||||
|
sinon.assert.calledOnce(spy);
|
||||||
|
spy.resetHistory();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should call alert.error", () => {
|
||||||
|
let spy = sinon.spy(Alert, "error");
|
||||||
|
Alert.error("message");
|
||||||
|
sinon.assert.calledOnce(spy);
|
||||||
|
spy.resetHistory();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should call alert.success", () => {
|
||||||
|
let spy = sinon.spy(Alert, "success");
|
||||||
|
Alert.success("message");
|
||||||
|
sinon.assert.calledOnce(spy);
|
||||||
|
spy.resetHistory();
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue