-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #355 from boostcampwm2023/BE-feature/spaces
ProfileSpace관련 동작 관련 모듈로 API 이동
- Loading branch information
Showing
22 changed files
with
1,276 additions
and
493 deletions.
There are no files selected for viewing
14 changes: 0 additions & 14 deletions
14
nestjs-BE/server/src/profile-space/dto/create-profile-space.dto.ts
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
nestjs-BE/server/src/profile-space/dto/update-profile-space.dto.ts
This file was deleted.
Oops, something went wrong.
126 changes: 0 additions & 126 deletions
126
nestjs-BE/server/src/profile-space/profile-space.controller.ts
This file was deleted.
Oops, something went wrong.
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
83 changes: 83 additions & 0 deletions
83
nestjs-BE/server/src/profile-space/profile-space.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { ProfileSpaceService } from './profile-space.service'; | ||
import { PrismaService } from '../prisma/prisma.service'; | ||
import { ProfileSpace } from '@prisma/client'; | ||
|
||
describe('ProfileSpaceService', () => { | ||
let profileSpaceService: ProfileSpaceService; | ||
let prisma: PrismaService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ | ||
ProfileSpaceService, | ||
{ | ||
provide: PrismaService, | ||
useValue: { | ||
profileSpace: { | ||
findFirst: jest.fn(), | ||
findUnique: jest.fn(), | ||
}, | ||
}, | ||
}, | ||
], | ||
}).compile(); | ||
|
||
profileSpaceService = module.get<ProfileSpaceService>(ProfileSpaceService); | ||
prisma = module.get<PrismaService>(PrismaService); | ||
}); | ||
|
||
it('isSpaceEmpty empty', async () => { | ||
const spaceUuid = 'space uuid'; | ||
|
||
(prisma.profileSpace.findFirst as jest.Mock).mockResolvedValue(null); | ||
|
||
const isSpaceEmpty = profileSpaceService.isSpaceEmpty(spaceUuid); | ||
|
||
await expect(isSpaceEmpty).resolves.toBeTruthy(); | ||
}); | ||
|
||
it('isSpaceEmpty not empty', async () => { | ||
const spaceUuid = 'space uuid'; | ||
const profileSpace = 'profile space'; | ||
|
||
(prisma.profileSpace.findFirst as jest.Mock).mockResolvedValue( | ||
profileSpace, | ||
); | ||
|
||
const isSpaceEmpty = profileSpaceService.isSpaceEmpty(spaceUuid); | ||
|
||
await expect(isSpaceEmpty).resolves.toBeFalsy(); | ||
}); | ||
|
||
it('isProfileInSpace joined', async () => { | ||
const spaceUuid = 'space uuid'; | ||
const profileUuid = 'profile uuid'; | ||
const profileSpaceMock = { profileUuid, spaceUuid } as ProfileSpace; | ||
|
||
(prisma.profileSpace.findUnique as jest.Mock).mockResolvedValue( | ||
profileSpaceMock, | ||
); | ||
|
||
const isProfileInSpace = profileSpaceService.isProfileInSpace( | ||
profileUuid, | ||
spaceUuid, | ||
); | ||
|
||
await expect(isProfileInSpace).resolves.toBeTruthy(); | ||
}); | ||
|
||
it('isProfileInSpace not joined', async () => { | ||
const spaceUuid = 'space uuid'; | ||
const profileUuid = 'profile uuid'; | ||
|
||
(prisma.profileSpace.findUnique as jest.Mock).mockResolvedValue(null); | ||
|
||
const isProfileInSpace = profileSpaceService.isProfileInSpace( | ||
profileUuid, | ||
spaceUuid, | ||
); | ||
|
||
await expect(isProfileInSpace).resolves.toBeFalsy(); | ||
}); | ||
}); |
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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Expose } from 'class-transformer'; | ||
import { IsNotEmpty, IsString } from 'class-validator'; | ||
import { v4 as uuid } from 'uuid'; | ||
|
||
export class JoinSpaceRequestDto { | ||
@IsString() | ||
@IsNotEmpty() | ||
@Expose({ name: 'profile_uuid' }) | ||
@ApiProperty({ example: uuid(), description: 'Profile uuid' }) | ||
profileUuid: string; | ||
} |
Oops, something went wrong.