fix issue with test make store helper

This commit is contained in:
Géry Debongnie
2019-03-04 09:57:48 +01:00
parent 78c6dca104
commit 5435dd6d25
2 changed files with 10 additions and 5 deletions
@@ -1,4 +1,4 @@
import { makeTestStore } from "../helpers";
import { makeTestStore, mockFetch } from "../helpers";
//------------------------------------------------------------------------------
// Tests
@@ -6,14 +6,19 @@ import { makeTestStore } from "../helpers";
test("does not reload action if already done", async () => {
const routes: string[] = [];
const store = makeTestStore({ rpc: async route => routes.push(route) });
const store = makeTestStore({
rpc: async (route, params) => {
routes.push(route);
return mockFetch(route, params);
}
});
expect(routes).toEqual([]);
store.doAction(32);
store.doAction(131);
expect(routes).toEqual(["web/action/load"]);
store.doAction(32);
store.doAction(131);
expect(routes).toEqual(["web/action/load"]);
});