Skip to content

Commit

Permalink
test: テストを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Jan 25, 2025
1 parent eed16bc commit 5a5c9de
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions packages/backend/test/e2e/antennas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ describe('アンテナ', () => {
caseSensitive: false,
createdAt: new Date(response.createdAt).toISOString(),
excludeKeywords: [['']],
hideNotesInSensitiveChannel: false,
hasUnreadNote: false,
isActive: true,
keywords: [['keyword']],
Expand Down Expand Up @@ -217,6 +218,8 @@ describe('アンテナ', () => {
{ parameters: () => ({ withReplies: true }) },
{ parameters: () => ({ withFile: false }) },
{ parameters: () => ({ withFile: true }) },
{ parameters: () => ({ hideNotesInSensitiveChannel: false }) },
{ parameters: () => ({ hideNotesInSensitiveChannel: true }) },
];
test.each(antennaParamPattern)('を作成できること($#)', async ({ parameters }) => {
const response = await successfulApiCall({
Expand Down Expand Up @@ -626,6 +629,42 @@ describe('アンテナ', () => {
assert.deepStrictEqual(response, expected);
});

test('が取得できること(センシティブチャンネルのノートを除く)', async () => {
const keyword = 'キーワード';
const antenna = await successfulApiCall({
endpoint: 'antennas/create',
parameters: { ...defaultParam, keywords: [[keyword]], hideNotesInSensitiveChannel: true },
user: alice,
});
const nonSensitiveChannel = await successfulApiCall({
endpoint: 'channels/create',
parameters: { name: 'test', isSensitive: false },
user: alice,
});
const sensitiveChannel = await successfulApiCall({
endpoint: 'channels/create',
parameters: { name: 'test', isSensitive: true },
user: alice,
});

const noteInLocal = await post(bob, { text: `test ${keyword}` });
const noteInNonSensitiveChannel = await post(bob, { text: `test ${keyword}`, channelId: nonSensitiveChannel.id });
await post(bob, { text: `test ${keyword}`, channelId: sensitiveChannel.id });

const response = await successfulApiCall({
endpoint: 'antennas/notes',
parameters: { antennaId: antenna.id },
user: alice,
});
// 最後に投稿したものが先頭に来る。
const expected = [
noteInNonSensitiveChannel,
noteInLocal,
];
assert.deepStrictEqual(response, expected);
});


test.skip('が取得でき、日付指定のPaginationに一貫性があること', async () => { });
test.each([
{ label: 'ID指定', offsetBy: 'id' },
Expand Down

0 comments on commit 5a5c9de

Please sign in to comment.