2019-03-04 09:57:48 +01:00
|
|
|
import { makeTestStore, mockFetch } from "../helpers";
|
2019-03-01 11:26:00 +01:00
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
// Tests
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
test("does not reload action if already done", async () => {
|
|
|
|
|
const routes: string[] = [];
|
2019-03-04 09:57:48 +01:00
|
|
|
const store = makeTestStore({
|
|
|
|
|
rpc: async (route, params) => {
|
|
|
|
|
routes.push(route);
|
|
|
|
|
return mockFetch(route, params);
|
|
|
|
|
}
|
|
|
|
|
});
|
2019-03-01 11:26:00 +01:00
|
|
|
expect(routes).toEqual([]);
|
|
|
|
|
|
2019-03-04 09:57:48 +01:00
|
|
|
store.doAction(131);
|
2019-03-01 11:26:00 +01:00
|
|
|
|
|
|
|
|
expect(routes).toEqual(["web/action/load"]);
|
|
|
|
|
|
2019-03-04 09:57:48 +01:00
|
|
|
store.doAction(131);
|
2019-03-01 11:26:00 +01:00
|
|
|
|
|
|
|
|
expect(routes).toEqual(["web/action/load"]);
|
|
|
|
|
});
|