Skip to content

Commit cb56fc1

Browse files
cjeongminyu-yj215
andauthored
chore: modify test workflow file (#240)
* chore: modify test workflow file * fix: resolve questions service test error --------- Co-authored-by: yu-yj215 <[email protected]>
1 parent 25c2005 commit cb56fc1

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,11 @@ jobs:
2727
- name: Create .env file
2828
run: echo "${{ secrets.FRONT_END_ENV }}" > apps/client/.env
2929

30+
- name: pnpx prisma generate
31+
run: |
32+
cd apps/server
33+
pnpx prisma generate
34+
cd ../..
35+
3036
- name: Run tests
31-
run: pnpm run test
37+
run: pnpm test

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"description": "질문과 답변을 넘어, 함께 만드는 인사이트, ‘Ask-It’",
55
"scripts": {
6-
"test": "turbo run test --filter='./apps/client/'"
6+
"test": "turbo run test"
77
},
88
"repository": {
99
"type": "git",

0 commit comments

Comments
 (0)