Snapshot URL datasets locally on add; preview tabular data as a table

This commit is contained in:
2026-06-10 10:24:42 +03:00
parent eb5e7ac53a
commit 2410c6e965
23 changed files with 1239 additions and 148 deletions
+17 -3
View File
@@ -111,7 +111,16 @@ describe('prepareSpecForRender — dataset resolution (spec §04 Rendering Contr
format: 'topojson',
source: 'inline',
},
{ name: 'UrlDs', data: 'https://x/y.csv', format: 'csv', source: 'url' },
// A fetched URL snapshot carries its payload in `data` (like inline); an
// unfetched reference has `data: null` and only its `url`.
{
name: 'UrlFetchedDs',
data: 'a,b\n1,2',
url: 'https://x/y.csv',
format: 'csv',
source: 'url',
},
{ name: 'UrlUnfetchedDs', data: null, url: 'https://x/y.csv', format: 'csv', source: 'url' },
];
test('inline JSON → values inlined', () => {
@@ -140,8 +149,13 @@ describe('prepareSpecForRender — dataset resolution (spec §04 Rendering Contr
});
});
test('URL → url reference tagged with the dataset format', () => {
const out = prepareSpecForRender({ data: { name: 'UrlDs' } }, { datasets });
test('fetched URL snapshot → its payload inlined, tagged with the format (like inline)', () => {
const out = prepareSpecForRender({ data: { name: 'UrlFetchedDs' } }, { datasets });
expect(out.data).toEqual({ values: 'a,b\n1,2', format: { type: 'csv' } });
});
test('unfetched URL reference → live url fallback tagged with the format', () => {
const out = prepareSpecForRender({ data: { name: 'UrlUnfetchedDs' } }, { datasets });
expect(out.data).toEqual({ url: 'https://x/y.csv', format: { type: 'csv' } });
});