Skip to content

Commit

Permalink
test improved
Browse files Browse the repository at this point in the history
  • Loading branch information
e11sy committed Jul 24, 2024
1 parent fa16dd4 commit e0605dc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
19 changes: 11 additions & 8 deletions src/presentation/http/router/note.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,14 @@ describe('Note API', () => {
expect(response?.json().message).toStrictEqual(expectedMessage);
});

// test.each
//
//
//
//
//
//

test.todo('Returns 400 when parentId has incorrect characters and length');
});

Expand Down Expand Up @@ -1882,23 +1890,18 @@ describe('Note API', () => {
if (expectedMessage !== null) {
expect(response?.json()).toStrictEqual({ message: expectedMessage });
} else {
expect(response?.json().noteHistoryMeta).toMatchObject([
expect(response?.json().noteHistoryMeta).toStrictEqual([
/**
* First history record created automatically on note insertion
*/
{
id: '1',
noteId: note.publicId,
id: 1,
userId: creator.id,
content: note.content,
tools: note.tools,
},
{
id: history.id,
noteId: history.noteId,
userId: history.userId,
content: history.content,
tools: history.tools,
createdAt: history.createdAt,
},
]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/presentation/http/router/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ const NoteRouter: FastifyPluginCallback<NoteRouterOptions> = (fastify, opts, don
noteHistoryMeta: {
type: 'array',
items: {
$ref: 'HistoryMetaSchema#',
$ref: 'HistoryMetaSchema',
},
},
},
Expand Down
26 changes: 14 additions & 12 deletions src/presentation/http/schema/History.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,19 @@ export const HistoryMetaSchema = {
'userId',
'createdAt',
],
id: {
description: 'unique note hisotry record identifier',
type: 'number',
},
userId: {
description: 'unique user identifier',
type: 'number',
},
createdAt: {
description: 'time, when note history record was created',
type: 'string',
format: 'date-time',
properties: {
id: {
description: 'unique note hisotry record identifier',
type: 'number',
},
userId: {
description: 'unique user identifier',
type: 'number',
},
createdAt: {
description: 'time, when note history record was created',
type: 'string',
format: 'date-time',
},
},
};

0 comments on commit e0605dc

Please sign in to comment.