-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: #1125: Update new redux flow for client apps
- Loading branch information
Showing
24 changed files
with
394 additions
and
194 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
import { clientLoading, clientReceiveData, clientRequestData, clientClearData } from '../client' | ||
import { | ||
clientAppSummaryRequestData, | ||
clientAppSummaryReceiveData, | ||
clientAppSummaryRequestDataFailure, | ||
clientAppSummaryClearData, | ||
} from '../client' | ||
import ActionTypes from '../../constants/action-types' | ||
import { appsDataStub, featuredAppsDataStub } from '../../sagas/__stubs__/apps' | ||
|
||
describe('client actions', () => { | ||
it('should create a clientLoading action', () => { | ||
expect(clientLoading.type).toEqual(ActionTypes.CLIENT_LOADING) | ||
expect(clientLoading(true).data).toEqual(true) | ||
it('should create a clientAppSummaryRequestData action', () => { | ||
expect(clientAppSummaryRequestData.type).toEqual(ActionTypes.CLIENT_APP_SUMMARY_REQUEST_DATA) | ||
expect(clientAppSummaryRequestData({ page: 1 }).data).toEqual({ page: 1 }) | ||
}) | ||
|
||
it('should create a clientReceiveData action', () => { | ||
expect(clientReceiveData.type).toEqual(ActionTypes.CLIENT_RECEIVE_DATA) | ||
expect(clientReceiveData({ featuredApps: featuredAppsDataStub.data.data, apps: appsDataStub.data }).data).toEqual({ | ||
it('should create a clientAppSummaryReceiveData action', () => { | ||
expect(clientAppSummaryReceiveData.type).toEqual(ActionTypes.CLIENT_APP_SUMMARY_RECEIVE_DATA) | ||
expect( | ||
clientAppSummaryReceiveData({ featuredApps: featuredAppsDataStub.data.data, apps: appsDataStub.data }).data, | ||
).toEqual({ | ||
featuredApps: featuredAppsDataStub.data.data, | ||
apps: appsDataStub.data, | ||
}) | ||
}) | ||
|
||
it('should create a clientRequestData action', () => { | ||
expect(clientRequestData.type).toEqual(ActionTypes.CLIENT_REQUEST_DATA) | ||
expect(clientRequestData({ page: 1 }).data).toEqual({ page: 1 }) | ||
it('should create a clientAppSummaryRequestDataFailure action', () => { | ||
expect(clientAppSummaryRequestDataFailure.type).toEqual(ActionTypes.CLIENT_APP_SUMMARY_REQUEST_FAILURE) | ||
expect(clientAppSummaryRequestDataFailure('error').data).toEqual('error') | ||
}) | ||
|
||
it('should create a clientClearData action', () => { | ||
expect(clientClearData.type).toEqual(ActionTypes.CLIENT_CLEAR_DATA) | ||
expect(clientClearData(null).data).toEqual(null) | ||
expect(clientAppSummaryClearData.type).toEqual(ActionTypes.CLIENT_APP_SUMMARY_CLEAR_DATA) | ||
expect(clientAppSummaryClearData(null).data).toEqual(null) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -1,9 +1,25 @@ | ||
import { actionCreator } from '../utils/actions' | ||
import ActionTypes from '../constants/action-types' | ||
import { ClientItem, ClientParams } from '../reducers/client' | ||
import { ClientAppSummary, ClientAppSummaryParams } from '../reducers/client/app-summary' | ||
import { AppDetailData } from '@/reducers/client/app-detail' | ||
|
||
export const clientRequestData = actionCreator<ClientParams>(ActionTypes.CLIENT_REQUEST_DATA) | ||
export const clientRequestDataFailure = actionCreator<void>(ActionTypes.CLIENT_REQUEST_FAILURE) | ||
export const clientLoading = actionCreator<boolean>(ActionTypes.CLIENT_LOADING) | ||
export const clientReceiveData = actionCreator<ClientItem | undefined>(ActionTypes.CLIENT_RECEIVE_DATA) | ||
export const clientClearData = actionCreator<null>(ActionTypes.CLIENT_CLEAR_DATA) | ||
export interface ClientAppDetailParams { | ||
id: string | ||
clientId?: string | ||
} | ||
|
||
export const clientAppSummaryRequestData = actionCreator<ClientAppSummaryParams>( | ||
ActionTypes.CLIENT_APP_SUMMARY_REQUEST_DATA, | ||
) | ||
export const clientAppSummaryReceiveData = actionCreator<ClientAppSummary | undefined>( | ||
ActionTypes.CLIENT_APP_SUMMARY_RECEIVE_DATA, | ||
) | ||
export const clientAppSummaryRequestDataFailure = actionCreator<string>(ActionTypes.CLIENT_APP_SUMMARY_REQUEST_FAILURE) | ||
export const clientAppSummaryClearData = actionCreator<null>(ActionTypes.CLIENT_APP_SUMMARY_CLEAR_DATA) | ||
|
||
// Client App Detail | ||
export const clientAppDetailRequestData = actionCreator<ClientAppDetailParams>( | ||
ActionTypes.CLIENT_APP_DETAIL_REQUEST_DATA, | ||
) | ||
export const clientAppDetailReceiveData = actionCreator<AppDetailData>(ActionTypes.CLIENT_APP_DETAIL_RECEIVE_DATA) | ||
export const clientAppDetailRequestFailure = actionCreator<string>(ActionTypes.CLIENT_APP_DETAIL_REQUEST_FAILURE) |
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
packages/marketplace/src/components/pages/client-app-detail/client-app-detail.tsx
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.