Skip to content

Commit 6b4b121

Browse files
committed
Removed duplicate method
1 parent 226df48 commit 6b4b121

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

src/presentation/http/router/note.test.ts

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MemberRole } from '@domain/entities/team.js';
22
import { describe, test, expect, beforeEach } from 'vitest';
33
import type User from '@domain/entities/user.js';
4-
import type { Note, NoteContent } from '@domain/entities/note.js';
4+
import type { Note } from '@domain/entities/note.js';
55

66
describe('Note API', () => {
77
/**
@@ -2278,23 +2278,6 @@ describe('Note API', () => {
22782278
let accessToken = '';
22792279
let user: User;
22802280

2281-
const getTitleFromContent = (content: NoteContent | undefined): string => {
2282-
const limitCharsForNoteTitle = 50;
2283-
2284-
if (!content) {
2285-
return 'Untitled';
2286-
}
2287-
2288-
const firstNoteBlock = content.blocks[0];
2289-
const text = (firstNoteBlock?.data as { text?: string })?.text;
2290-
2291-
if (text === undefined || text.trim() === '') {
2292-
return 'Untitled';
2293-
}
2294-
2295-
return text.replace(/ /g, ' ').slice(0, limitCharsForNoteTitle);
2296-
};
2297-
22982281
beforeEach(async () => {
22992282
/** create test user */
23002283
user = await global.db.insertUser();
@@ -2307,7 +2290,10 @@ describe('Note API', () => {
23072290
{
23082291
description: 'Should get note hierarchy with no parent or child when noteId passed has no relations',
23092292
setup: async () => {
2310-
const note = await global.db.insertNote({ creatorId: user.id });
2293+
const note = await global.db.insertNote({
2294+
creatorId: user.id,
2295+
content: DEFAULT_NOTE_CONTENT,
2296+
});
23112297

23122298
await global.db.insertNoteSetting({
23132299
noteId: note.id,
@@ -2322,7 +2308,7 @@ describe('Note API', () => {
23222308

23232309
expected: (note: Note, childNote: Note | null) => ({
23242310
noteId: note.publicId,
2325-
noteTitle: getTitleFromContent(note.content),
2311+
noteTitle: 'text',
23262312
childNotes: childNote,
23272313
}),
23282314
},
@@ -2331,8 +2317,14 @@ describe('Note API', () => {
23312317
{
23322318
description: 'Should get note hierarchy with child when noteId passed has relations',
23332319
setup: async () => {
2334-
const childNote = await global.db.insertNote({ creatorId: user.id });
2335-
const parentNote = await global.db.insertNote({ creatorId: user.id });
2320+
const childNote = await global.db.insertNote({
2321+
creatorId: user.id,
2322+
content: DEFAULT_NOTE_CONTENT,
2323+
});
2324+
const parentNote = await global.db.insertNote({
2325+
creatorId: user.id,
2326+
content: DEFAULT_NOTE_CONTENT,
2327+
});
23362328

23372329
await global.db.insertNoteSetting({
23382330
noteId: childNote.id,
@@ -2354,11 +2346,11 @@ describe('Note API', () => {
23542346
},
23552347
expected: (note: Note, childNote: Note | null) => ({
23562348
noteId: note.publicId,
2357-
noteTitle: getTitleFromContent(note.content),
2349+
noteTitle: 'text',
23582350
childNotes: [
23592351
{
23602352
noteId: childNote?.publicId,
2361-
noteTitle: getTitleFromContent(childNote?.content),
2353+
noteTitle: 'text',
23622354
childNotes: null,
23632355
},
23642356
],

0 commit comments

Comments
 (0)