tmagic-editor/packages/data-source/tests/createDataSourceManager.spec.ts
2023-05-29 11:33:44 +08:00

50 lines
949 B
TypeScript

import { describe, expect, test } from 'vitest';
import { MApp, MNode, NodeType } from '@tmagic/schema';
import { createDataSourceManager, DataSourceManager } from '@data-source/index';
const dsl: MApp = {
type: NodeType.ROOT,
id: 'app_1',
items: [
{
type: NodeType.PAGE,
id: 'page_1',
items: [
{
type: 'text',
id: 61705611,
text: '{{ds_bebcb2d5.text}}',
},
],
},
],
dataSourceDeps: {
ds_bebcb2d5: {
61705611: {
name: '文本',
keys: ['text'],
},
},
},
dataSources: [
{
id: 'ds_bebcb2d5',
type: 'http',
fields: [
{
name: 'text',
},
],
},
],
};
describe('createDataSourceManager', () => {
test('instance', () => {
const manager = createDataSourceManager(dsl, (node: MNode) => node, {});
expect(manager).toBeInstanceOf(DataSourceManager);
});
});