Skip to content

Commit 2dd854b

Browse files
committed
fix: resolve questions service test error
1 parent 7fdb5e5 commit 2dd854b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

apps/server/src/questions/questions.service.spec.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ describe('QuestionsService', () => {
130130
body: 'Test question',
131131
closed: false,
132132
pinned: false,
133-
createdAt: new Date(),
133+
createdAt: new Date('2024-12-02T09:40:17.170Z'),
134134
createUserToken: 'test-token',
135135
createUserTokenEntity: {
136136
user: {
137137
userId: 1,
138-
createdAt: new Date(),
138+
createdAt: new Date('2024-12-02T09:39:17.170Z'),
139139
140140
password: 'hashedPassword',
141141
nickname: 'TestUser',
@@ -153,7 +153,7 @@ describe('QuestionsService', () => {
153153
createUserToken: 'reply-token',
154154
questionId: 1,
155155
sessionId: 'test-session',
156-
createdAt: new Date(),
156+
createdAt: new Date('2024-12-02T09:41:17.170Z'),
157157
deleted: false,
158158
replyLikes: [
159159
{
@@ -163,7 +163,7 @@ describe('QuestionsService', () => {
163163
createUserTokenEntity: {
164164
user: {
165165
userId: 1,
166-
createdAt: new Date(),
166+
createdAt: new Date('2024-12-02T09:40:17.170Z'),
167167
168168
password: 'hashedPassword',
169169
nickname: 'ReplyUser',
@@ -174,11 +174,12 @@ describe('QuestionsService', () => {
174174
},
175175
];
176176

177+
const date = new Date('2024-12-02T09:40:17.170Z');
177178
const mockSession = {
178179
sessionId: 'test-session',
179-
createdAt: new Date(),
180+
createdAt: new Date('2024-12-02T09:40:17.170Z'),
180181
title: 'Test Session',
181-
expiredAt: new Date(),
182+
expiredAt: new Date(date.getTime() + 7 * 24 * 60 * 60 * 1000),
182183
createUserId: 1,
183184
};
184185

0 commit comments

Comments
 (0)