-
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.
* 구글 로그인에 대한 테스트를 작성하고 커버리지를 올린다.
- Loading branch information
Showing
6 changed files
with
65 additions
and
17 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
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 |
---|---|---|
|
@@ -9,6 +9,8 @@ import { | |
postLogin, | ||
postSignup, | ||
postLogout, | ||
uploadProductImages, | ||
postGoogleSignIn, | ||
} from './api'; | ||
|
||
import products, { userProducts } from '../../fixtures/products'; | ||
|
@@ -56,6 +58,31 @@ describe('api', () => { | |
}); | ||
}); | ||
|
||
describe('uploadProductImages', () => { | ||
it('returns productImages', async () => { | ||
const files = [ | ||
new File(['file'], 'productImage1.png', { | ||
type: 'application/json', | ||
}), | ||
new File(['file'], 'productImage2.png', { | ||
type: 'application/json', | ||
}), | ||
new File(['file'], 'productImage3.png', { | ||
type: 'application/json', | ||
}), | ||
]; | ||
|
||
const data = await uploadProductImages({ files }); | ||
|
||
const productImages = files.map((file, _) => ({ | ||
name: file.name, | ||
imageUrl: 'MOCK_IMAGE_URL', | ||
})); | ||
|
||
expect(data).toEqual(productImages); | ||
}); | ||
}); | ||
|
||
describe('postEditProduct', () => { | ||
it('request product post edit', async () => { | ||
const productId = 1; | ||
|
@@ -83,12 +110,13 @@ describe('api', () => { | |
}); | ||
|
||
context('productImages is empty', () => { | ||
it('request only product pos delete', async () => { | ||
const emptyImagesProductPost = { | ||
it('request only post delete', async () => { | ||
const emptyImagesInPost = { | ||
...product, | ||
productImages: [], | ||
}; | ||
await postDeleteProduct({ product: emptyImagesProductPost }); | ||
|
||
await postDeleteProduct({ product: emptyImagesInPost }); | ||
}); | ||
}); | ||
}); | ||
|
@@ -108,6 +136,14 @@ describe('api', () => { | |
}); | ||
}); | ||
|
||
describe('postGoogleSignin', () => { | ||
it('returns user', async () => { | ||
const data = await postGoogleSignIn(); | ||
|
||
expect(data).toEqual(logInUser); | ||
}); | ||
}); | ||
|
||
describe('postSignup', () => { | ||
it('returns sign up user', async () => { | ||
const email = '[email protected]'; | ||
|
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