Skip to content

Commit

Permalink
add-test
Browse files Browse the repository at this point in the history
  • Loading branch information
penginn-net committed Oct 1, 2024
1 parent 399f63c commit 38af416
Showing 1 changed file with 121 additions and 0 deletions.
121 changes: 121 additions & 0 deletions packages/backend/test/e2e/search-notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,17 @@ describe('検索', () => {
const asnids1 = asres1.body.map( x => x.id);
assert.strictEqual(asnids1.includes(reactedNote.id), true);
});
test('indexable false(通常検索) リアクションしたら出てくる', async() => {
const sres1 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(sres1.status, 200);
assert.strictEqual(Array.isArray(sres1.body), true);
assert.strictEqual(sres1.body.length, 1);

const snids1 = sres1.body.map( x => x.id);
assert.strictEqual(snids1.includes(reactedNote.id), true);
});
let rnId: string;
test('indexable false リノートしたら出てくる', async() => {
const rnres = await api('notes/create', {
Expand All @@ -347,6 +358,17 @@ describe('検索', () => {
const asnids2 = asres2.body.map( x => x.id);
assert.strictEqual(asnids2.includes(renotedNote.id), true);
});
test('indexable false(通常検索) リノートしたら出てくる', async() => {
const sres2 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(sres2.status, 200);
assert.strictEqual(Array.isArray(sres2.body), true);
assert.strictEqual(sres2.body.length, 2);

const snids2 = sres2.body.map( x => x.id);
assert.strictEqual(snids2.includes(renotedNote.id), true);
});
let replyId: string;
test('indexable false 返信したら出てくる', async() => {
const rpres = await api('notes/create', {
Expand All @@ -367,6 +389,17 @@ describe('検索', () => {
const asnids3 = asres3.body.map( x => x.id);
assert.strictEqual(asnids3.includes(replyedNote.id), true);
});
test('indexable false(通常検索) 返信したら出てくる', async() => {
const sres3 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(sres3.status, 200);
assert.strictEqual(Array.isArray(sres3.body), true);
assert.strictEqual(sres3.body.length, 3);

const snids3 = sres3.body.map( x => x.id);
assert.strictEqual(snids3.includes(replyedNote.id), true);
});
test('indexable false お気に入りしたら出てくる', async() => {
const fvres = await api('notes/favorites/create', {
noteId: favoritedNote.id,
Expand All @@ -384,6 +417,17 @@ describe('検索', () => {
const asnids4 = asres4.body.map( x => x.id);
assert.strictEqual(asnids4.includes(favoritedNote.id), true);
});
test('indexable false(通常検索) お気に入りしたら出てくる', async() => {
const sres4 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(sres4.status, 200);
assert.strictEqual(Array.isArray(sres4.body), true);
assert.strictEqual(sres4.body.length, 4);

const snids4 = sres4.body.map( x => x.id);
assert.strictEqual(snids4.includes(favoritedNote.id), true);
});
let clpId: string;
test('indexable false クリップしたら出てくる', async() => {
const clpres = await api('clips/create', {
Expand All @@ -409,6 +453,17 @@ describe('検索', () => {
const asnids5 = asres5.body.map( x => x.id);
assert.strictEqual(asnids5.includes(clipedNote.id), true);
});
test('indexable false(通常検索) クリップしたら出てくる', async() => {
const sres5 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(sres5.status, 200);
assert.strictEqual(Array.isArray(sres5.body), true);
assert.strictEqual(sres5.body.length, 5);

const snids5 = sres5.body.map( x => x.id);
assert.strictEqual(snids5.includes(clipedNote.id), true);
});
test('indexable false 投票したら出てくる', async() => {
const vres = await api('notes/polls/vote', {
noteId: votedNote.id,
Expand All @@ -426,6 +481,17 @@ describe('検索', () => {
const asnids6 = asres6.body.map( x => x.id);
assert.strictEqual(asnids6.includes(votedNote.id), true);
});
test('indexable false(通常検索) 投票したら出てくる', async() => {
const asres6 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(asres6.status, 200);
assert.strictEqual(Array.isArray(asres6.body), true);
assert.strictEqual(asres6.body.length, 6);

const asnids6 = asres6.body.map( x => x.id);
assert.strictEqual(asnids6.includes(votedNote.id), true);
});
//
test('indexable false リアクション外したらでない', async() => {
const rres = await api('notes/reactions/delete', {
Expand All @@ -443,6 +509,17 @@ describe('検索', () => {
const asnids1 = asres1.body.map( x => x.id);
assert.strictEqual(asnids1.includes(reactedNote.id), false);
});
test('indexable false(通常検索) リアクション外したらでない', async() => {
const asres1 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(asres1.status, 200);
assert.strictEqual(Array.isArray(asres1.body), true);
assert.strictEqual(asres1.body.length, 5);

const asnids1 = asres1.body.map( x => x.id);
assert.strictEqual(asnids1.includes(reactedNote.id), false);
});
test('indexable false リノート消したらでない', async() => {
const rnres = await api('notes/delete', {
noteId: rnId,
Expand All @@ -459,6 +536,17 @@ describe('検索', () => {
const asnids2 = asres2.body.map( x => x.id);
assert.strictEqual(asnids2.includes(renotedNote.id), false);
});
test('indexable false(通常検索) リノート消したらでない', async() => {
const asres2 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(asres2.status, 200);
assert.strictEqual(Array.isArray(asres2.body), true);
assert.strictEqual(asres2.body.length, 4);

const asnids2 = asres2.body.map( x => x.id);
assert.strictEqual(asnids2.includes(renotedNote.id), false);
});
test('indexable false リプライ消したらでない', async() => {
const rnres = await api('notes/delete', {
noteId: replyId,
Expand All @@ -475,6 +563,17 @@ describe('検索', () => {
const asnids2 = asres2.body.map( x => x.id);
assert.strictEqual(asnids2.includes(renotedNote.id), false);
});
test('indexable false(通常検索) リプライ消したらでない', async() => {
const asres2 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(asres2.status, 200);
assert.strictEqual(Array.isArray(asres2.body), true);
assert.strictEqual(asres2.body.length, 3);

const asnids2 = asres2.body.map( x => x.id);
assert.strictEqual(asnids2.includes(renotedNote.id), false);
});
test('indexable false クリップ消したらでない', async() => {
const clpaddres = await api('clips/remove-note', {
clipId: clpId,
Expand All @@ -492,6 +591,17 @@ describe('検索', () => {
const asnids5 = asres5.body.map( x => x.id);
assert.strictEqual(asnids5.includes(clipedNote.id), false);
});
test('indexable false(通常検索) クリップ消したらでない', async() => {
const asres5 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(asres5.status, 200);
assert.strictEqual(Array.isArray(asres5.body), true);
assert.strictEqual(asres5.body.length, 2);

const asnids5 = asres5.body.map( x => x.id);
assert.strictEqual(asnids5.includes(clipedNote.id), false);
});
test('indexable false お気に入り消したらでない', async() => {
const fvres = await api('notes/favorites/delete', { noteId: favoritedNote.id }, alice);
assert.strictEqual(fvres.status, 204);
Expand All @@ -507,5 +617,16 @@ describe('検索', () => {
const asnids4 = asres4.body.map( x => x.id);
assert.strictEqual(asnids4.includes(favoritedNote.id), false);
});
test('indexable false(通常検索) お気に入り消したらでない', async() => {
const asres4 = await api('notes/search', {
query: 'indexable_text',
}, alice);
assert.strictEqual(asres4.status, 200);
assert.strictEqual(Array.isArray(asres4.body), true);
assert.strictEqual(asres4.body.length, 1);

const asnids4 = asres4.body.map( x => x.id);
assert.strictEqual(asnids4.includes(favoritedNote.id), false);
});
//投票は消せないので対象外
});

0 comments on commit 38af416

Please sign in to comment.