-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
809f87c
commit 1c84825
Showing
9 changed files
with
107 additions
and
42 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
19 changes: 19 additions & 0 deletions
19
src/store/containers/createBookForm/failureCreateBook.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,19 @@ | ||
import '@/rejectTestConfiguration' | ||
import { createStore } from '@/store/root' | ||
import { bookFactory } from '@/stub/domain/factory/IBook' | ||
import flushPromises from 'flush-promises' | ||
import { createBook } from './action' | ||
import selector from './selector' | ||
|
||
|
||
test('本の登録に失敗する', async () => { | ||
const store = createStore() | ||
expect(selector.isSendFailed(store.state)).toBe(false) | ||
expect(selector.isSending(store.state)).toBe(false) | ||
expect(selector.isSendSuccess(store.state)).toBe(false) | ||
store.dispatch(createBook({params: bookFactory()})) | ||
await flushPromises() | ||
expect(selector.isSending(store.state)).toBe(false) | ||
expect(selector.isSendFailed(store.state)).toBe(true) | ||
expect(selector.isSendSuccess(store.state)).toBe(false) | ||
}) |
22 changes: 0 additions & 22 deletions
22
src/store/containers/createBookForm/failureUpdateProfile.spec.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import '@/resolveTestConfiguration' | ||
import { createStore } from '@/store/root' | ||
import { bookFactory } from '@/stub/domain/factory/IBook' | ||
import flushPromises from 'flush-promises' | ||
import { createBook } from './action' | ||
import selector from './selector' | ||
|
||
|
||
test('本の登録に成功する', async () => { | ||
const store = createStore() | ||
expect(selector.isSendFailed(store.state)).toBe(false) | ||
expect(selector.isSending(store.state)).toBe(false) | ||
expect(selector.isSendSuccess(store.state)).toBe(false) | ||
store.dispatch(createBook({params: bookFactory()})) | ||
expect(selector.isSending(store.state)).toBe(true) | ||
await flushPromises() | ||
expect(selector.isSending(store.state)).toBe(false) | ||
expect(selector.isSendFailed(store.state)).toBe(false) | ||
expect(selector.isSendSuccess(store.state)).toBe(true) | ||
}) |
20 changes: 0 additions & 20 deletions
20
src/store/containers/createBookForm/successUpdateProfile.spec.ts
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
src/stub/domain/app/bookApplicationService/RejectService.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,16 @@ | ||
import { IBookApplicationService } from '@/boundary/bookApplicationService/IBookApplicationService' | ||
import { injectable } from 'inversify' | ||
|
||
@injectable() | ||
export class BookApplicationService implements IBookApplicationService { | ||
|
||
public create(): Promise<void> { | ||
throw Error() | ||
} | ||
public update(): Promise<void> { | ||
throw Error() | ||
} | ||
public delete(): Promise<void> { | ||
throw Error() | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/stub/domain/app/bookApplicationService/ResolveService.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,16 @@ | ||
import { IBookApplicationService } from '@/boundary/bookApplicationService/IBookApplicationService' | ||
import { injectable } from 'inversify' | ||
|
||
@injectable() | ||
export class BookApplicationService implements IBookApplicationService { | ||
|
||
public async create(): Promise<void> { | ||
// pass | ||
} | ||
public async update(): Promise<void> { | ||
// pass | ||
} | ||
public async delete(): Promise<void> { | ||
// pass | ||
} | ||
} |
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,30 @@ | ||
import { | ||
BookType, | ||
IBook, | ||
Owner, | ||
PurchasedLocation, | ||
} from '@/boundary/bookApplicationService/InOutType' | ||
import uuid from 'uuid' | ||
|
||
export function bookFactory(params?: Partial<IBook>): IBook { | ||
const date = new Date() | ||
return { | ||
id: uuid(), | ||
userId: '', | ||
title: '', | ||
purchasedLocation: PurchasedLocation.ONLINE, | ||
purchasedDatetime: date, | ||
description: '', | ||
type: BookType.PHYSICAL_BOOK, | ||
price: 1000, | ||
owner: Owner.COMPANY, | ||
purchasedUrl: '', | ||
downloadUrl: '', | ||
coverImageFilePath: '', | ||
evaluation: null, | ||
receiptImageFilePath: '', | ||
createdAt: date, | ||
updatedAt: date, | ||
...params, | ||
} | ||
} |