BREAKING CHANGE(core): switch to esm

This commit is contained in:
2022-03-25 13:31:21 +01:00
parent 431089e23f
commit 592228fc51
9 changed files with 4793 additions and 13871 deletions

View File

@ -1,5 +1,5 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartstate from '../ts/index';
import * as smartstate from '../ts/index.js';
type TMyStateParts = 'testStatePart';
interface TStatePartPayload {
@ -14,7 +14,7 @@ let testStatePart: smartstate.StatePart<TMyStateParts, TStatePartPayload>;
tap.test('should create a new SmartState', async () => {
testState = new smartstate.Smartstate<TMyStateParts>();
expect(testState).to.be.instanceOf(smartstate.Smartstate);
expect(testState).toBeInstanceOf(smartstate.Smartstate);
});
tap.test('should create a new StatePart', async () => {
@ -24,7 +24,7 @@ tap.test('should create a new StatePart', async () => {
hi: 2,
},
});
expect(testStatePart).to.be.instanceOf(smartstate.StatePart);
expect(testStatePart).toBeInstanceOf(smartstate.StatePart);
console.log(testStatePart);
});
@ -32,7 +32,7 @@ tap.test('should select something', async () => {
testStatePart
.select((state) => state.deep.hi)
.subscribe((substate) => {
expect(substate).to.equal(2);
expect(substate).toEqual(2);
});
});
@ -51,7 +51,7 @@ tap.test('should dispatch a state action', async (tools) => {
done.resolve();
});
await testStatePart.dispatchAction(addFavourite, 'my favourite things');
expect(testStatePart.getState().currentFavorites).to.include('my favourite things');
expect(testStatePart.getState().currentFavorites).toContain('my favourite things');
await done.promise;
});