-
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.
Browse files
Browse the repository at this point in the history
Feat/#39 ํ ์คํธ ์ฝ๋ ์์ฑ
- Loading branch information
Showing
12 changed files
with
436 additions
and
115 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
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,5 @@ | ||
import { EntityRepository, Repository } from 'typeorm'; | ||
import { ToySite } from '../entities/ToySite'; | ||
|
||
@EntityRepository(ToySite) | ||
export class ToySiteRepository extends Repository<ToySite> {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { UserRepository } from '../../../src/repositories/UserRepository'; | ||
import { UserService } from '../../../src/services/UserService'; | ||
import { AuthService } from '../../../src/services/AuthService'; | ||
import { createMemoryDatabase } from '../../utils/CreateMemoryDatabase'; | ||
import { UserSeed } from '../../utils/seeds/UserTestSeed'; | ||
import { Connection } from 'typeorm'; | ||
import { CreateUserDto } from '../../../src/dtos/UserDto'; | ||
import { ReturnErrorType } from '../../../src/constants/ReturnErrorType'; | ||
import { CreateTokenDto } from '../../../src/dtos/AuthDto'; | ||
|
||
describe('AuthService', () => { | ||
let db: Connection; | ||
let userRepository: UserRepository; | ||
let authService: AuthService; | ||
let userService: UserService; | ||
|
||
beforeAll(async () => { | ||
db = await createMemoryDatabase(); | ||
userRepository = db.getCustomRepository(UserRepository); | ||
await userRepository.save(UserSeed); | ||
userService = new UserService(userRepository); | ||
authService = new AuthService(userRepository); | ||
}); | ||
|
||
afterAll(() => db.close()); | ||
|
||
const request = { | ||
accessToken: 'accessToken', | ||
refreshToken: 'refreshToken', | ||
}; | ||
|
||
it('์ ํจํ์ง ์์ ๋ฆฌํ๋ ์ ํ ํฐ์ด ์ค๋ฉด ํ ํฐ์ ๋ฐ๊ธํ์ง ์๋๋ค.', async () => { | ||
const isUser = await authService.validateUserBySnsId(request.accessToken); | ||
|
||
if (isUser) { | ||
const accessToken = generateAccessToken(isUser); | ||
} else { | ||
expect(isUser).toBeNull(); | ||
} | ||
}); | ||
}); | ||
|
||
function generateAccessToken(user: any) { | ||
throw new Error('Function not implemented.'); | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export const ThemeSeed = [ | ||
{ | ||
id: 0, | ||
title: 'title', | ||
image: 'image', | ||
subtitle: 'subtitle', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
{ | ||
id: 1, | ||
title: 'title', | ||
image: 'image', | ||
subtitle: 'subtitle', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
{ | ||
id: 2, | ||
title: 'title', | ||
image: 'image', | ||
subtitle: 'subtitle', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
]; |
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,56 @@ | ||
export const ToySiteSeed = [ | ||
{ | ||
id: 1, | ||
toySite: 'toySite', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
{ | ||
id: 2, | ||
toySite: 'toySite', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
{ | ||
id: 3, | ||
toySite: 'toySite', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
{ | ||
id: 4, | ||
toySite: 'toySite', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
{ | ||
id: 5, | ||
toySite: 'toySite', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
{ | ||
id: 6, | ||
toySite: 'toySite', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
{ | ||
id: 7, | ||
toySite: 'toySite', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
{ | ||
id: 8, | ||
toySite: 'toySite', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
{ | ||
id: 9, | ||
toySite: 'toySite', | ||
createdAt: `${new Date()}`, | ||
updatedAt: `${new Date()}`, | ||
}, | ||
]; |
Oops, something went wrong.