feat(qzone,onebot): add set_qzone_ban action for qzone blacklist management (#193)
* feat(onebot,qzone): add set_qzone_ban action for qzone blacklist management * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <[email protected]> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <[email protected]> --------- Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This commit is contained in:
1 parent
6cb7f2c6d0
commit
d3eb3bae14
6 files changed
+269
-14
No files matched your search
@@ -89,4 +89,34 @@ describe('qzone actions', () => {
|
||||
expect(updateRight).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('set_qzone_ban with enable=true calls setBlack with ban=true', async () => {
|
||||
const setBlack = vi.fn().mockResolvedValue(undefined);
|
||||
const handler = makeHandler({ setBlack });
|
||||
|
||||
const res = await handler.handle('set_qzone_ban', { user_id: 12345, enable: true });
|
||||
|
||||
expect(res).toMatchObject({ status: 'ok', retcode: 0 });
|
||||
expect(setBlack).toHaveBeenCalledWith(12345, true);
|
||||
});
|
||||
|
||||
it('set_qzone_ban with enable=false calls setBlack with ban=false', async () => {
|
||||
const setBlack = vi.fn().mockResolvedValue(undefined);
|
||||
const handler = makeHandler({ setBlack });
|
||||
|
||||
const res = await handler.handle('set_qzone_ban', { user_id: 12345, enable: false });
|
||||
|
||||
expect(res).toMatchObject({ status: 'ok', retcode: 0 });
|
||||
expect(setBlack).toHaveBeenCalledWith(12345, false);
|
||||
});
|
||||
|
||||
it('set_qzone_ban defaults enable to true', async () => {
|
||||
const setBlack = vi.fn().mockResolvedValue(undefined);
|
||||
const handler = makeHandler({ setBlack });
|
||||
|
||||
const res = await handler.handle('set_qzone_ban', { user_id: 12345 });
|
||||
|
||||
expect(res).toMatchObject({ status: 'ok', retcode: 0 });
|
||||
expect(setBlack).toHaveBeenCalledWith(12345, true);
|
||||
});
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user