UNPKG

1.25 kBJavaScriptView Raw
1"use strict";
2
3var _queueReducer = require("./queue-reducer");
4
5var _queueReducer2 = _interopRequireDefault(_queueReducer);
6
7function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
9describe("queueReducer", function () {
10 it("should convert nextActions to queue", function () {
11 var state = {
12 game: {
13 nextActions: [{
14 action: { type: "TEST_ACTION" }
15 }]
16 }
17 };
18 var after = (0, _queueReducer2.default)(state, { type: "TEST_ACTION_2" });
19 expect(after.game.queue[0].type).toEqual("object");
20 expect(after.game.queue[0].properties.type.enum[0]).toEqual("TEST_ACTION");
21 });
22
23 it("should accept/reject actions", function () {
24 var state = {
25 game: {
26 queue: [{
27 type: "object",
28 properties: {
29 type: {
30 enum: ["TEST_ACTION"]
31 }
32 }
33 }]
34 }
35 };
36 (0, _queueReducer2.default)(state, { type: "TEST_ACTION" });
37 expect(function () {
38 (0, _queueReducer2.default)(state, { type: "INVALID_ACTION" });
39 }).toThrow();
40 expect(function () {
41 (0, _queueReducer2.default)(state, null);
42 }).toThrow();
43 });
44});
45//# sourceMappingURL=queue-reducer.spec.js.map
\No newline at end of file