mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Snapshot URL datasets locally on add; preview tabular data as a table
This commit is contained in:
@@ -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' } });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user