Datasets: URL→inline conversion drops url/fetchedAt

This commit is contained in:
2026-06-11 19:26:47 +03:00
parent fe2b039698
commit 181b9da8ab
2 changed files with 30 additions and 6 deletions
+15
View File
@@ -112,6 +112,21 @@ describe('URL dataset edits & refresh', () => {
expect(ds.name).toBe('Remote'); // preserved
});
test('a URL→inline conversion removes the url/fetchedAt keys (not left undefined)', () => {
const id = seedUrl();
store().startEdit();
store().updateForm({ source: 'inline', input: '[{"x":1},{"x":2}]' });
const later = new Date('2026-07-01T00:00:00Z');
expect(store().save(later)).toBe(true);
const ds = store().datasets.find((d) => d.id === id)!;
expect(ds.source).toBe('inline');
expect(ds.rowCount).toBe(2);
// The remote origin is shed entirely — the keys are gone, not present-but-undefined,
// so an inline record carries no stale url/fetchedAt.
expect('url' in ds).toBe(false);
expect('fetchedAt' in ds).toBe(false);
});
test('refreshDataset is a no-op for an inline dataset', () => {
store().add(
createDataset({ name: 'Inline', data: [{ a: 1 }], format: 'json', source: 'inline', now: T }),