Bring in packages/montar
This commit is contained in:
parent
fe4509a2ae
commit
67f7cf8e1b
19 changed files with 800 additions and 24 deletions
37
packages/montar/src/starting.spec.ts
Normal file
37
packages/montar/src/starting.spec.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { defState, stop, startOnly, startWithout } from ".";
|
||||
|
||||
const startOnlyState = defState("startOnlyState", {
|
||||
start: async () => ({
|
||||
value: 42,
|
||||
}),
|
||||
});
|
||||
|
||||
const startedState = defState("startState", {
|
||||
start: async () => ({
|
||||
value: 42,
|
||||
}),
|
||||
});
|
||||
|
||||
const neverStartedState = defState("neverStartedState", {
|
||||
start: async () => ({
|
||||
value: 42,
|
||||
}),
|
||||
});
|
||||
|
||||
describe("starting", () => {
|
||||
afterEach(async () => stop());
|
||||
|
||||
test("startOnly", async () => {
|
||||
await startOnly(["startOnlyState"]);
|
||||
expect(startOnlyState.value).toBe(42);
|
||||
expect(startedState.value).toBe(undefined);
|
||||
expect(neverStartedState.value).toBe(undefined);
|
||||
});
|
||||
|
||||
test("startWithout", async () => {
|
||||
await startWithout(["neverStartedState"]);
|
||||
expect(startOnlyState.value).toBe(42);
|
||||
expect(startedState.value).toBe(42);
|
||||
expect(neverStartedState.value).toBe(undefined);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue