Skip to content

Commit

Permalink
Merge branch 'develop' into enh-notecount-settings-1
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih authored Mar 7, 2024
2 parents 38cb618 + 412e9f2 commit f4564e2
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions packages/backend/test/e2e/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ describe('Note', () => {
priority: 0,
value: true,
},
},
} as any,
}, alice);

assert.strictEqual(res.status, 200);
Expand Down Expand Up @@ -784,7 +784,7 @@ describe('Note', () => {
priority: 1,
value: 0,
},
},
} as any,
}, alice);

assert.strictEqual(res.status, 200);
Expand Down Expand Up @@ -838,7 +838,7 @@ describe('Note', () => {
priority: 1,
value: 0,
},
},
} as any,
}, alice);

assert.strictEqual(res.status, 200);
Expand Down Expand Up @@ -894,7 +894,7 @@ describe('Note', () => {
priority: 1,
value: 1,
},
},
} as any,
}, alice);

assert.strictEqual(res.status, 200);
Expand Down
20 changes: 19 additions & 1 deletion packages/backend/test/e2e/timelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()]);

Expand Down
7 changes: 7 additions & 0 deletions packages/backend/test/global.d.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 2 deletions packages/backend/test/prelude/get-api-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]+$/);
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedParameters": false,
"noUnusedLocals": true,
"noUnusedLocals": false,
"noFallthroughCasesInSwitch": true,
"declaration": false,
"sourceMap": true,
Expand All @@ -18,6 +18,7 @@
"strict": true,
"strictNullChecks": true,
"strictPropertyInitialization": false,
"skipLibCheck": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"resolveJsonModule": true,
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/test/unit/RelayService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down

0 comments on commit f4564e2

Please sign in to comment.