-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed: extend compose.up return value
- Loading branch information
Viktor Pasynok
committed
Nov 5, 2024
1 parent
02c08d4
commit db89ce3
Showing
5 changed files
with
94 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,36 @@ | ||
import type { AnyContainer } from '../../createContainer'; | ||
import type { StoreValue } from 'effector'; | ||
import { createContainer, type AnyContainer } from '../../createContainer'; | ||
import { compose } from '../index'; | ||
|
||
test('compose.up parameters', () => { | ||
expectTypeOf<Parameters<typeof compose.up>[0]>().toEqualTypeOf<AnyContainer[]>(); | ||
describe('compose.up', () => { | ||
test('parameters', () => { | ||
expectTypeOf<Parameters<typeof compose.up>[0]>().toEqualTypeOf<AnyContainer[]>(); | ||
}); | ||
|
||
test('return type', async () => { | ||
const a = createContainer({ | ||
id: 'a', | ||
start: () => ({ api: { t: () => true } }), | ||
}); | ||
const b = createContainer({ | ||
id: 'b', | ||
start: () => ({ api: { f: () => false } }), | ||
}); | ||
|
||
const upResult = await compose.up([a, b]); | ||
|
||
type UpResult = { | ||
hasErrors: boolean; | ||
statuses: { | ||
[a.id]: StoreValue<typeof a.$status>; | ||
[b.id]: StoreValue<typeof b.$status>; | ||
}; | ||
apis: { | ||
[a.id]?: { t: () => true }; | ||
[b.id]?: { f: () => false }; | ||
}; | ||
}; | ||
|
||
expectTypeOf<UpResult>().toEqualTypeOf<typeof upResult>(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters