-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
109 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...sicspot/src/journey/journey.controller.ts → .../journey/controller/journey.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
12 changes: 6 additions & 6 deletions
12
BE/musicspot/src/journey/journey.module.ts → ...spot/src/journey/module/journey.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { JourneyService } from './journey.service'; | ||
import mongoose from 'mongoose'; | ||
import { User, UserSchema } from '../../user/schema/user.schema'; | ||
import { Journey, JourneySchema } from '../schema/journey.schema'; | ||
import { getModelToken } from '@nestjs/mongoose'; | ||
import { StartJourneyDTO } from '../dto/journeyStart.dto'; | ||
import { UserService } from '../../user/serivce/user.service'; | ||
|
||
describe('JourneysService', () => { | ||
let service: JourneyService; | ||
let userModel; | ||
let journeyModel; | ||
|
||
beforeAll(async () => { | ||
mongoose.connect( | ||
`mongodb://${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}`, | ||
); | ||
userModel = mongoose.model(User.name, UserSchema); | ||
journeyModel = mongoose.model(Journey.name, JourneySchema); | ||
|
||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ | ||
JourneyService, | ||
UserService, | ||
{ | ||
provide: getModelToken(Journey.name), | ||
useValue: journeyModel, | ||
}, | ||
{ | ||
provide: getModelToken(User.name), | ||
useValue: userModel, | ||
}, | ||
], | ||
}).compile(); | ||
|
||
service = module.get<JourneyService>(JourneyService); | ||
}); | ||
|
||
it('journey 시작 테스트', async () => { | ||
const coordinate = [37.675986, 126.776032]; | ||
const timestamp = '2023-11-22T15:30:00.000+09:00'; | ||
const email = 'test-email'; | ||
|
||
const createJourneyData: StartJourneyDTO = { | ||
coordinate, | ||
timestamp, | ||
email, | ||
}; | ||
|
||
const createdJourneyData = | ||
await service.insertJourneyData(createJourneyData); | ||
expect(coordinate).toEqual(createdJourneyData.coordinates[0]); | ||
expect(timestamp).toEqual(createdJourneyData.timestamp); | ||
expect(createdJourneyData.spots).toEqual([]); | ||
|
||
const updateUserInfo = await service.pushJourneyIdToUser( | ||
createdJourneyData._id, | ||
email, | ||
); | ||
// console.log(createdUserData); | ||
expect(updateUserInfo.modifiedCount).toEqual(1); | ||
}); | ||
|
||
afterAll(async () => { | ||
mongoose.connection.close(); | ||
}); | ||
}); |
12 changes: 6 additions & 6 deletions
12
BE/musicspot/src/journey/journey.service.ts → ...ot/src/journey/service/journey.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
BE/musicspot/src/spot/spot.module.ts → BE/musicspot/src/spot/module/spot.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
BE/musicspot/src/user/user.module.ts → BE/musicspot/src/user/module/user.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
BE/musicspot/src/user/user.service.spec.ts → ...pot/src/user/serivce/user.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
BE/musicspot/src/user/user.service.ts → ...usicspot/src/user/serivce/user.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters