Skip to content

Commit 1f475c3

Browse files
committed
test: better assertions
1 parent 4169d46 commit 1f475c3

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/notebooks/deepnote/deepnoteTreeDataProvider.unit.test.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,32 @@ suite('DeepnoteTreeDataProvider', () => {
174174
// Call refresh to reset state - this exercises the refresh logic
175175
newProvider.refresh();
176176

177-
// After refresh - should work without errors
177+
// After refresh - should return to initial state (loading or empty)
178178
const childrenAfterRefresh = await newProvider.getChildren();
179179
assert.isArray(childrenAfterRefresh);
180180

181+
// Verify that refresh reset to initial scan state
182+
// The post-refresh state should match the initial state
183+
assert.strictEqual(
184+
childrenAfterRefresh.length,
185+
firstChildren.length,
186+
'After refresh, should return to initial state with same number of children'
187+
);
188+
189+
// If initial state had a loading item, post-refresh should too
190+
if (firstChildren.length > 0 && firstChildren[0].contextValue === 'loading') {
191+
assert.strictEqual(
192+
childrenAfterRefresh[0].contextValue,
193+
'loading',
194+
'After refresh, should show loading item again'
195+
);
196+
assert.strictEqual(
197+
childrenAfterRefresh[0].label,
198+
firstChildren[0].label,
199+
'Loading item label should match initial state'
200+
);
201+
}
202+
181203
if (newProvider && typeof newProvider.dispose === 'function') {
182204
newProvider.dispose();
183205
}

0 commit comments

Comments
 (0)