smartcls/test/test.ts
2024-06-06 18:26:11 +02:00

29 lines
863 B
TypeScript

import { expect, tap } from '@push.rocks/tapbundle';
import * as smartcls from '../ts/index.js';
const testSmartcls = new smartcls.SmartCls();
tap.testParallel('should get namespace', async (tools) => {
testSmartcls.run(async () => {
testSmartcls.set('some', 'anything');
await tools.delayFor(1000);
expect(testSmartcls.get('some')).toEqual('anything');
tools.delayFor(200).then(() => {
expect(testSmartcls.get('some')).toEqual('anything');
});
});
});
tap.testParallel('should get namespace with other values', async (tools) => {
testSmartcls.run(async () => {
testSmartcls.set('some', 'otherthing');
await tools.delayFor(500);
expect(testSmartcls.get('some')).toEqual('otherthing');
tools.delayFor(200).then(() => {
expect(testSmartcls.get('some')).toEqual('otherthing');
});
});
});
tap.start();