MCPcopy
hub / github.com/smapiot/piral / createMockContainer

Function createMockContainer

src/framework/piral-core/src/setters/SetRoute.test.tsx:14–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12FakeRoute.displayName = 'FakeRoute';
13
14function createMockContainer() {
15 const state = create(() => ({
16 routes: {},
17 }));
18 return {
19 context: {
20 on: vitest.fn(),
21 off: vitest.fn(),
22 emit: vitest.fn(),
23 state,
24 setRoute(name, comp) {
25 const update = (s) => ({
26 ...s,
27 routes: {
28 ...s.routes,
29 [name]: comp,
30 },
31 });
32 state.setState(update(state.getState()));
33 },
34 } as any,
35 };
36}
37
38describe('Piral-Core SetRoute component', () => {
39 it('SetRoute sets the link route in the store', () => {

Callers 1

SetRoute.test.tsxFile · 0.70

Calls 1

createFunction · 0.50

Tested by

no test coverage detected