Skip to content

Commit ad07f2c

Browse files
azulusclaude
andcommitted
test(seer): Assert full nested snapshot shape with toEqual
Replaces the per-property assertions in the nesting test with a single deep equality check against the expected tree, so a failure prints the full actual vs expected shape in one diff. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 053be11 commit ad07f2c

1 file changed

Lines changed: 24 additions & 19 deletions

File tree

static/app/views/seerExplorer/contexts/seerContext.spec.tsx

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -102,26 +102,31 @@ describe('registerSeerContext — nesting', () => {
102102
</SeerContextProvider>
103103
);
104104

105-
// Wait for the cascade of registration effects to settle
105+
// Wait for the cascade of registration effects to settle, then assert the
106+
// entire nested shape in one pass so the failure message shows the full tree.
106107
await waitFor(() => {
107-
const snapshot = getSnapshot();
108-
109-
expect(snapshot.nodes).toHaveLength(1);
110-
111-
const [dashboard] = snapshot.nodes;
112-
expect(dashboard?.nodeType).toBe('dashboard');
113-
expect(dashboard?.data).toEqual({name: 'Backend Health'});
114-
expect(dashboard?.children).toHaveLength(1);
115-
116-
const [widget] = dashboard?.children ?? [];
117-
expect(widget?.nodeType).toBe('widget');
118-
// Widgets carry multiple fields to verify non-trivial payloads
119-
expect(widget?.data).toEqual({title: 'Error Rate', type: 'timeseries', unit: 'ms'});
120-
expect(widget?.children).toHaveLength(1);
121-
122-
const [chart] = widget?.children ?? [];
123-
expect(chart?.nodeType).toBe('chart');
124-
expect(chart?.data).toEqual({label: 'p99'});
108+
expect(getSnapshot()).toEqual({
109+
version: expect.any(Number),
110+
nodes: [
111+
{
112+
nodeType: 'dashboard',
113+
data: {name: 'Backend Health'},
114+
children: [
115+
{
116+
nodeType: 'widget',
117+
data: {title: 'Error Rate', type: 'timeseries', unit: 'ms'},
118+
children: [
119+
{
120+
nodeType: 'chart',
121+
data: {label: 'p99'},
122+
children: [],
123+
},
124+
],
125+
},
126+
],
127+
},
128+
],
129+
});
125130
});
126131
});
127132
});

0 commit comments

Comments
 (0)