Files
tools/test/test.ts
T

34 lines
1.2 KiB
TypeScript

import { tap, expect } from '@git.zone/tstest/tapbundle';
import { createEmptyContract } from '../ts/index.js';
import { demoContract } from '../ts_demodata/index.js';
tap.test('re-exports interfaces from the tools entry point', async () => {
const contract = createEmptyContract(
'Service Agreement',
'service',
'service_agreement',
'user-123'
);
expect(contract.metadata.category).toEqual('service');
});
tap.test('exports demo data against the shared interfaces package', async () => {
expect(demoContract.lifecycle.currentStatus).toEqual('draft');
});
tap.test('built public export paths resolve after build', async () => {
const toolsExportPath = '../dist_ts/index.js';
const interfacesExportPath = '../dist_ts/interfaces.js';
const demodataExportPath = '../dist_ts_demodata/index.js';
const tools = await import(toolsExportPath);
const interfaces = await import(interfacesExportPath);
const demodata = await import(demodataExportPath);
expect(typeof tools.createEmptyContract).toEqual('function');
expect(typeof interfaces.createEmptyContract).toEqual('function');
expect(demodata.demoContract.lifecycle.currentStatus).toEqual('draft');
});
export default tap.start();