mirror of
https://github.com/MisskeyIO/misskey
synced 2024-11-27 06:18:40 +09:00
test(backend): enable typecheck by workflow (#13526)
This commit is contained in:
parent
7ead98cbe5
commit
412e9f284d
@ -19,7 +19,7 @@
|
||||
"watch": "node watch.mjs",
|
||||
"restart": "pnpm build && pnpm start",
|
||||
"dev": "nodemon -w src -e ts,js,mjs,cjs,json --exec \"cross-env NODE_ENV=development pnpm run restart\"",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsc --noEmit && tsc -p test --noEmit",
|
||||
"eslint": "eslint --quiet \"src/**/*.ts\"",
|
||||
"lint": "pnpm typecheck && pnpm eslint",
|
||||
"jest": "cross-env NODE_ENV=test node --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --forceExit --config jest.config.unit.cjs",
|
||||
|
@ -472,7 +472,7 @@ describe('Note', () => {
|
||||
priority: 0,
|
||||
value: true,
|
||||
},
|
||||
},
|
||||
} as any,
|
||||
}, alice);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
@ -784,7 +784,7 @@ describe('Note', () => {
|
||||
priority: 1,
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
} as any,
|
||||
}, alice);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
@ -838,7 +838,7 @@ describe('Note', () => {
|
||||
priority: 1,
|
||||
value: 0,
|
||||
},
|
||||
},
|
||||
} as any,
|
||||
}, alice);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
@ -894,7 +894,7 @@ describe('Note', () => {
|
||||
priority: 1,
|
||||
value: 1,
|
||||
},
|
||||
},
|
||||
} as any,
|
||||
}, alice);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
|
@ -890,17 +890,35 @@ describe('Timelines', () => {
|
||||
|
||||
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
||||
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
||||
await api('users/lists/update-membership', { listId: list.id, userId: bob.id, withReplies: false }, alice);
|
||||
await sleep(1000);
|
||||
const aliceNote = await post(alice, { text: 'hi' });
|
||||
const bobNote = await post(bob, { text: 'hi', replyId: aliceNote.id });
|
||||
|
||||
await waitForPushToTl();
|
||||
|
||||
const res = await api('notes/user-list-timeline', { listId: list.id, withReplies: false }, alice);
|
||||
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
||||
|
||||
assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), true);
|
||||
});
|
||||
|
||||
test.concurrent('withReplies: false でリスインしているフォローしていないユーザーの他人への返信が含まれない', async () => {
|
||||
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
||||
|
||||
const list = await api('users/lists/create', { name: 'list' }, alice).then(res => res.body);
|
||||
await api('users/lists/push', { listId: list.id, userId: bob.id }, alice);
|
||||
await api('users/lists/update-membership', { listId: list.id, userId: bob.id, withReplies: false }, alice);
|
||||
await sleep(1000);
|
||||
const carolNote = await post(carol, { text: 'hi' });
|
||||
const bobNote = await post(bob, { text: 'hi', replyId: carolNote.id });
|
||||
|
||||
await waitForPushToTl();
|
||||
|
||||
const res = await api('notes/user-list-timeline', { listId: list.id }, alice);
|
||||
|
||||
assert.strictEqual(res.body.some((note: any) => note.id === bobNote.id), false);
|
||||
});
|
||||
|
||||
test.concurrent('withReplies: true でリスインしているフォローしていないユーザーの他人への返信が含まれる', async () => {
|
||||
const [alice, bob, carol] = await Promise.all([signup(), signup(), signup()]);
|
||||
|
||||
|
7
packages/backend/test/global.d.ts
vendored
Normal file
7
packages/backend/test/global.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type FIXME = any;
|
@ -4,10 +4,10 @@
|
||||
*/
|
||||
|
||||
import Ajv from 'ajv';
|
||||
import { Schema } from '@/misc/schema';
|
||||
import { Schema } from '@/misc/json-schema.js';
|
||||
|
||||
export const getValidator = (paramDef: Schema) => {
|
||||
const ajv = new Ajv({
|
||||
const ajv = new Ajv.default({
|
||||
useDefaults: true,
|
||||
});
|
||||
ajv.addFormat('misskey:id', /^[a-zA-Z0-9]+$/);
|
||||
|
@ -5,7 +5,7 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noUnusedParameters": false,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedLocals": false,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"declaration": false,
|
||||
"sourceMap": true,
|
||||
@ -18,6 +18,7 @@
|
||||
"strict": true,
|
||||
"strictNullChecks": true,
|
||||
"strictPropertyInitialization": false,
|
||||
"skipLibCheck": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true,
|
||||
|
@ -90,7 +90,8 @@ describe('RelayService', () => {
|
||||
|
||||
expect(queueService.deliver).toHaveBeenCalled();
|
||||
expect(queueService.deliver.mock.lastCall![1]?.type).toBe('Undo');
|
||||
expect(queueService.deliver.mock.lastCall![1]?.object.type).toBe('Follow');
|
||||
expect(typeof queueService.deliver.mock.lastCall![1]?.object).toBe('object');
|
||||
expect((queueService.deliver.mock.lastCall![1]?.object as any).type).toBe('Follow');
|
||||
expect(queueService.deliver.mock.lastCall![2]).toBe('https://example.com');
|
||||
//expect(queueService.deliver.mock.lastCall![0].username).toBe('relay.actor');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user