mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 16:44:48 -07:00
implement gameboard v1
This commit is contained in:
parent
b103db681b
commit
0d7336edc2
177 changed files with 16995 additions and 139 deletions
|
|
@ -63,6 +63,8 @@ export const disconnectedState: Partial<RootState> = {
|
|||
messages: {},
|
||||
sortGamesBy: { field: App.GameSortField.START_TIME, order: App.SortDirection.DESC },
|
||||
sortUsersBy: { field: App.UserSortField.NAME, order: App.SortDirection.ASC },
|
||||
selectedGameIds: {},
|
||||
gameFilters: {},
|
||||
},
|
||||
games: { games: {} },
|
||||
action: { type: null, payload: null, meta: null, error: false, count: 0 },
|
||||
|
|
@ -122,3 +124,27 @@ export const connectedWithRoomsState: Partial<RootState> = {
|
|||
};
|
||||
|
||||
export { makeUser };
|
||||
|
||||
/**
|
||||
* Deep-partial of a root state. Let specs pass partial slice shapes
|
||||
* (typically just `games: { games: { ... } }`) without the ~60 fields of
|
||||
* server/rooms that the test doesn't care about.
|
||||
*/
|
||||
type DeepPartial<T> = T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
||||
|
||||
/**
|
||||
* Wraps a partial root-state literal with a safe single `as`-cast so specs
|
||||
* don't need to sprinkle `as any` on every `preloadedState` argument. The
|
||||
* runtime value is the exact same literal; the only thing this helper buys
|
||||
* is deleting the `as any` cast from call sites.
|
||||
*
|
||||
* @example
|
||||
* renderWithProviders(<MyComponent />, {
|
||||
* preloadedState: makeStoreState({
|
||||
* games: { games: { 1: makeGameEntry({ ... }) } },
|
||||
* }),
|
||||
* });
|
||||
*/
|
||||
export function makeStoreState(partial: DeepPartial<RootState>): Partial<RootState> {
|
||||
return partial as Partial<RootState>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue