rename web into demo

This commit is contained in:
Géry Debongnie
2019-03-14 11:02:14 +01:00
parent 75218b65e7
commit 2ffb0fd64c
1731 changed files with 8 additions and 12 deletions
@@ -0,0 +1,46 @@
import { Registry } from "../../src/ts/core/registry";
import { makeTestEnv } from "../helpers";
//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------
test("does not reload action if already done", async () => {
const routes: string[] = [];
const testEnv = makeTestEnv({
mockRPC(route, params) {
routes.push(route);
return this.rpc(route, params);
}
});
expect(routes).toEqual([]);
testEnv.store.doAction(131);
expect(routes).toEqual(["web/action/load"]);
testEnv.store.doAction(131);
expect(routes).toEqual(["web/action/load"]);
});
test("display a warning if client action is not in registry", async () => {
const testEnv = makeTestEnv({ actionRegistry: new Registry() });
await testEnv.store.doAction(131);
const notifs = testEnv.store.state.notifications;
expect(notifs.length).toBe(1);
expect(notifs[0].type).toBe("warning");
});
test("display a warning if view is not in registry", async () => {
const testEnv = makeTestEnv({ viewRegistry: new Registry() });
await testEnv.store.doAction(250);
const notifs = testEnv.store.state.notifications;
expect(notifs.length).toBe(1);
expect(notifs[0].type).toBe("warning");
});