2024-06-06 16:26:11 +00:00
|
|
|
import { expect, tap } from '@push.rocks/tapbundle';
|
|
|
|
import * as smartcls from '../ts/index.js';
|
2017-10-12 09:19:54 +00:00
|
|
|
|
2020-07-20 07:39:47 +00:00
|
|
|
const testSmartcls = new smartcls.SmartCls();
|
2017-10-12 09:19:54 +00:00
|
|
|
|
2020-07-20 07:39:47 +00:00
|
|
|
tap.testParallel('should get namespace', async (tools) => {
|
|
|
|
testSmartcls.run(async () => {
|
|
|
|
testSmartcls.set('some', 'anything');
|
2018-03-04 23:57:41 +00:00
|
|
|
await tools.delayFor(1000);
|
2024-06-06 16:26:11 +00:00
|
|
|
expect(testSmartcls.get('some')).toEqual('anything');
|
2017-10-12 09:19:54 +00:00
|
|
|
tools.delayFor(200).then(() => {
|
2024-06-06 16:26:11 +00:00
|
|
|
expect(testSmartcls.get('some')).toEqual('anything');
|
2018-03-04 23:57:41 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-10-12 09:19:54 +00:00
|
|
|
|
2020-07-20 07:39:47 +00:00
|
|
|
tap.testParallel('should get namespace with other values', async (tools) => {
|
|
|
|
testSmartcls.run(async () => {
|
|
|
|
testSmartcls.set('some', 'otherthing');
|
2018-03-04 23:57:41 +00:00
|
|
|
await tools.delayFor(500);
|
2024-06-06 16:26:11 +00:00
|
|
|
expect(testSmartcls.get('some')).toEqual('otherthing');
|
2017-10-12 09:19:54 +00:00
|
|
|
tools.delayFor(200).then(() => {
|
2024-06-06 16:26:11 +00:00
|
|
|
expect(testSmartcls.get('some')).toEqual('otherthing');
|
2018-03-04 23:57:41 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-10-12 09:19:54 +00:00
|
|
|
|
2018-03-04 23:57:41 +00:00
|
|
|
tap.start();
|