test: update test code for detecting note deletion
This commit is contained in:
parent
03f53991e0
commit
019f844e40
|
@ -1,4 +1,4 @@
|
|||
import assert, { rejects, strictEqual } from 'node:assert';
|
||||
import assert, { notEqual, rejects, strictEqual } from 'node:assert';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { addCustomEmoji, createAccount, createModerator, deepStrictEqualWithExcludedFields, type LoginUser, resolveRemoteNote, resolveRemoteUser, sleep, uploadFile } from './utils.js';
|
||||
|
||||
|
@ -154,13 +154,8 @@ describe('Note', () => {
|
|||
await bob.client.request('notes/delete', { noteId: note.id });
|
||||
await sleep();
|
||||
|
||||
await rejects(
|
||||
async () => await carol.client.request('notes/show', { noteId: noteInA.id }),
|
||||
(err: any) => {
|
||||
strictEqual(err.code, 'NO_SUCH_NOTE');
|
||||
return true;
|
||||
},
|
||||
);
|
||||
const noteInARemoved = await carol.client.request('notes/show', { noteId: noteInA.id });
|
||||
notEqual(noteInARemoved.deletedAt, null);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
@ -179,13 +174,8 @@ describe('Note', () => {
|
|||
await bob.client.request('notes/delete', { noteId: note.id });
|
||||
await sleep();
|
||||
|
||||
await rejects(
|
||||
async () => await alice.client.request('notes/show', { noteId: noteInA.id }),
|
||||
(err: any) => {
|
||||
strictEqual(err.code, 'NO_SUCH_NOTE');
|
||||
return true;
|
||||
},
|
||||
);
|
||||
const noteInARemoved = await alice.client.request('notes/show', { noteId: noteInA.id });
|
||||
notEqual(noteInARemoved.deletedAt, null);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -199,13 +189,8 @@ describe('Note', () => {
|
|||
await bob.client.request('notes/delete', { noteId: note.id });
|
||||
await sleep();
|
||||
|
||||
await rejects(
|
||||
async () => await alice.client.request('notes/show', { noteId: noteInA.id }),
|
||||
(err: any) => {
|
||||
strictEqual(err.code, 'NO_SUCH_NOTE');
|
||||
return true;
|
||||
},
|
||||
);
|
||||
const noteInARemoved = await alice.client.request('notes/show', { noteId: noteInA.id });
|
||||
notEqual(noteInARemoved.deletedAt, null);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -241,13 +226,9 @@ describe('Note', () => {
|
|||
const noteInB = await resolveRemoteNote('a.test', note.id, bob);
|
||||
const bMod = await createModerator('b.test');
|
||||
await bMod.client.request('notes/delete', { noteId: noteInB.id });
|
||||
await rejects(
|
||||
async () => await bob.client.request('notes/show', { noteId: noteInB.id }),
|
||||
(err: any) => {
|
||||
strictEqual(err.code, 'NO_SUCH_NOTE');
|
||||
return true;
|
||||
},
|
||||
);
|
||||
|
||||
const noteInBRemoved = await bob.client.request('notes/show', { noteId: noteInB.id });
|
||||
notEqual(noteInBRemoved.deletedAt, null);
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue