From 18bf057721f4650a95b2c29ce086df7297599771 Mon Sep 17 00:00:00 2001 From: Vu Nguyen Date: Wed, 27 May 2020 09:47:33 +0700 Subject: [PATCH] feat: #1325 Update tests for submit-app selector --- .../src/selector/__tests__/submit-app.test.ts | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 packages/marketplace/src/selector/__tests__/submit-app.test.ts diff --git a/packages/marketplace/src/selector/__tests__/submit-app.test.ts b/packages/marketplace/src/selector/__tests__/submit-app.test.ts new file mode 100644 index 0000000000..5bf00c781b --- /dev/null +++ b/packages/marketplace/src/selector/__tests__/submit-app.test.ts @@ -0,0 +1,49 @@ +import { ReduxState } from '@/types/core' +import { selectSubmitAppRevisionState, selectSubmitAppState } from '../submit-app' +import appState from '@/reducers/__stubs__/app-state' + +const mockState: ReduxState = { + ...appState, + submitRevision: { + formState: 'PENDING', + }, + submitApp: { + formState: 'PENDING', + loading: false, + submitAppData: { + scopes: [ + { + description: 'test', + name: 'test', + }, + ], + }, + }, +} + +describe('selectSubmitAppRevisionState', () => { + it('should run correctly', () => { + const result = selectSubmitAppRevisionState(mockState) + expect(result).toEqual({ + formState: 'PENDING', + }) + }) +}) + +describe('selectSubmitAppState', () => { + it('should run correctly', () => { + const result = selectSubmitAppState(mockState) + expect(result).toEqual({ + formState: 'PENDING', + loading: false, + submitAppData: { + scopes: [ + { + description: 'test', + name: 'test', + }, + ], + }, + }) + }) +})