mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 17:16:01 +00:00
fixed perspective tests
This commit is contained in:
@@ -94,48 +94,49 @@ test('test two level nesting', () => {
|
|||||||
const artistTable = chinookDbInfo.tables.find(x => x.pureName == 'Artist');
|
const artistTable = chinookDbInfo.tables.find(x => x.pureName == 'Artist');
|
||||||
const config = createPerspectiveConfig({ pureName: 'Artist' });
|
const config = createPerspectiveConfig({ pureName: 'Artist' });
|
||||||
config.nodes.push(createPerspectiveNodeConfig({ pureName: 'Album' }));
|
config.nodes.push(createPerspectiveNodeConfig({ pureName: 'Album' }));
|
||||||
|
config.nodes.push(createPerspectiveNodeConfig({ pureName: 'Track' }));
|
||||||
config.references.push({
|
config.references.push({
|
||||||
sourceId: config.nodes[0].designerId,
|
sourceId: config.nodes[0].designerId,
|
||||||
targetId: config.nodes[1].designerId,
|
targetId: config.nodes[1].designerId,
|
||||||
designerId: '1',
|
designerId: '1',
|
||||||
columns: [{ source: 'ArtistId', target: 'ArtistId' }],
|
columns: [{ source: 'ArtistId', target: 'ArtistId' }],
|
||||||
});
|
});
|
||||||
config.nodes[0].checkedColumns = ['Album'];
|
config.references.push({
|
||||||
config.nodes[1].checkedColumns = ['Track'];
|
sourceId: config.nodes[1].designerId,
|
||||||
|
targetId: config.nodes[2].designerId,
|
||||||
|
designerId: '2',
|
||||||
|
columns: [{ source: 'AlbumId', target: 'AlbumId' }],
|
||||||
|
});
|
||||||
|
const configColumns = processPerspectiveDefaultColunns(config, { conid: { db: chinookDbInfo } }, 'conid', 'db');
|
||||||
|
|
||||||
const root = new PerspectiveTableNode(
|
const root = new PerspectiveTableNode(
|
||||||
artistTable,
|
artistTable,
|
||||||
{ conid: { db: chinookDbInfo } },
|
{ conid: { db: chinookDbInfo } },
|
||||||
config,
|
configColumns,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
{ conid: 'conid', database: 'db' },
|
{ conid: 'conid', database: 'db' },
|
||||||
null,
|
null,
|
||||||
config.nodes[0].designerId
|
configColumns.nodes[0].designerId
|
||||||
);
|
);
|
||||||
const display = new PerspectiveDisplay(root, artistDataAlbumTrack);
|
const display = new PerspectiveDisplay(root, artistDataAlbumTrack);
|
||||||
|
|
||||||
console.log(display.rows);
|
console.log(display.rows);
|
||||||
expect(display.rows.length).toEqual(8);
|
expect(display.rows.length).toEqual(8);
|
||||||
expect(display.rows[0]).toEqual(
|
|
||||||
expect.objectContaining({
|
expect(display.rows[0].rowData).toEqual([
|
||||||
rowData: ['AC/DC', 'For Those About To Rock We Salute You', 'For Those About To Rock (We Salute You)'],
|
'AC/DC',
|
||||||
rowSpans: [4, 2, 1],
|
'For Those About To Rock We Salute You',
|
||||||
rowCellSkips: [false, false, false],
|
'For Those About To Rock (We Salute You)',
|
||||||
})
|
]);
|
||||||
);
|
expect(display.rows[0].rowSpans).toEqual([4, 2, 1]);
|
||||||
expect(display.rows[1]).toEqual(
|
expect(display.rows[0].rowCellSkips).toEqual([false, false, false]);
|
||||||
expect.objectContaining({
|
|
||||||
rowData: [undefined, undefined, 'Put The Finger On You'],
|
expect(display.rows[1].rowData).toEqual([undefined, undefined, 'Put The Finger On You']);
|
||||||
rowSpans: [1, 1, 1],
|
expect(display.rows[1].rowSpans).toEqual([1, 1, 1]);
|
||||||
rowCellSkips: [true, true, false],
|
expect(display.rows[1].rowCellSkips).toEqual([true, true, false]);
|
||||||
})
|
|
||||||
);
|
expect(display.rows[2].rowData).toEqual([undefined, 'Let There Be Rock', 'Go Down']);
|
||||||
expect(display.rows[2]).toEqual(
|
expect(display.rows[2].rowSpans).toEqual([1, 2, 1]);
|
||||||
expect.objectContaining({
|
expect(display.rows[2].rowCellSkips).toEqual([true, false, false]);
|
||||||
rowData: [undefined, 'Let There Be Rock', 'Go Down'],
|
|
||||||
rowSpans: [1, 2, 1],
|
|
||||||
rowCellSkips: [true, false, false],
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user