mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
upgrade packages + improve typing
This commit is contained in:
parent
fd55f4fb7f
commit
19f5eefdd2
138 changed files with 4504 additions and 11015 deletions
|
|
@ -8,7 +8,7 @@ export function getWarnList(modName: string, userName: string, userClientid: str
|
|||
BackendService.sendModeratorCommand(Command_GetWarnList_ext, create(Command_GetWarnListSchema, { modName, userName, userClientid }), {
|
||||
responseExt: Response_WarnList_ext,
|
||||
onSuccess: (response) => {
|
||||
ModeratorPersistence.warnListOptions(response.warning);
|
||||
ModeratorPersistence.warnListOptions([response]);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,10 @@ import { updateAdminNotes } from './updateAdminNotes';
|
|||
import { viewLogHistory } from './viewLogHistory';
|
||||
import { warnUser } from './warnUser';
|
||||
|
||||
const { getLastSendOpts, invokeOnSuccess } = makeCallbackHelpers(
|
||||
BackendService.sendModeratorCommand as vi.Mock,
|
||||
import { Mock } from 'vitest';
|
||||
|
||||
const { invokeOnSuccess } = makeCallbackHelpers(
|
||||
BackendService.sendModeratorCommand as Mock,
|
||||
2
|
||||
);
|
||||
|
||||
|
|
@ -175,11 +177,11 @@ describe('getWarnList', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('onSuccess calls ModeratorPersistence.warnListOptions with warning', () => {
|
||||
it('onSuccess calls ModeratorPersistence.warnListOptions with the response', () => {
|
||||
getWarnList('mod1', 'alice', 'US');
|
||||
const resp = { warning: ['w1', 'w2'] };
|
||||
const resp = { warning: ['w1', 'w2'], userName: 'alice', userClientid: 'US' };
|
||||
invokeOnSuccess(resp, { responseCode: 0 });
|
||||
expect(ModeratorPersistence.warnListOptions).toHaveBeenCalledWith(['w1', 'w2']);
|
||||
expect(ModeratorPersistence.warnListOptions).toHaveBeenCalledWith([resp]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue