MCPcopy Index your code
hub / github.com/tinyplex/tinybase / testContextPrimitives

Function testContextPrimitives

test/unit/core/ui-common/primitives.ts:64–110  ·  view source on GitHub ↗
(
  framework: string,
  harness: PrimitiveHarness,
  components: ContextPrimitiveComponents,
)

Source from the content-addressed store, hash-verified

62};
63
64export const testContextPrimitives = (
65 framework: string,
66 harness: PrimitiveHarness,
67 components: ContextPrimitiveComponents,
68): void => {
69 let things: ContextPrimitiveProps;
70
71 beforeEach(() => {
72 things = createTestThings();
73 });
74
75 describe(`${framework} context primitive scenarios`, () => {
76 test('provided things and ids', () => {
77 const {container, unmount} = harness.render(components.Things, things);
78 expect(container.textContent).toEqual(
79 JSON.stringify([
80 ['store1'],
81 ['metrics1'],
82 ['indexes1'],
83 ['relationships1'],
84 ['queries1'],
85 ['checkpoints1'],
86 ['persister1'],
87 ['synchronizer1'],
88 ...(components.hasStores ? [true] : []),
89 true,
90 true,
91 true,
92 true,
93 true,
94 true,
95 true,
96 true,
97 ]),
98 );
99 unmount();
100 });
101
102 test('missing context', () => {
103 const {container, unmount} = harness.render(components.NoContext, {});
104 expect(container.textContent).toEqual(
105 JSON.stringify([[], [], [], [], [], [], [], []]),
106 );
107 unmount();
108 });
109 });
110};

Callers 3

hooks.test.tsxFile · 0.90
primitives.test.tsFile · 0.90
functions.test.tsFile · 0.90

Calls 3

createTestThingsFunction · 0.85
testFunction · 0.50
renderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…