From 46bdce7eb8674ae615e5d4e7b196bf20a5734598 Mon Sep 17 00:00:00 2001 From: Pham Hai Duong Date: Tue, 11 Feb 2020 15:24:18 +0800 Subject: [PATCH] fix: #49 update backend change for lifetime legal app (#223) --- .../src/tests/badges/badge-branches.svg | 2 +- .../elements/src/tests/badges/badge-lines.svg | 2 +- .../src/tests/badges/badge-statements.svg | 2 +- .../__tests__/combine-address.ts | 156 +++++++++++++++++- .../__tests__/completed-sections.ts | 114 ++++++++++++- .../completed-section/completed-sections.ts | 8 +- .../elements/src/utils/datetime/datetime.ts | 1 + .../validators/__tests__/validate-require.ts | 5 + .../types/marketplace-api-schema.ts | 1 - .../primary-identification.tsx.snap | 2 +- .../secondary-identification.tsx.snap | 2 +- .../core/__tests__/private-route-wrapper.tsx | 20 ++- .../src/core/private-route-wrapper.tsx | 2 +- .../src/sagas/__stubs__/contact.ts | 2 +- .../src/sagas/__stubs__/identity-check.ts | 2 +- .../src/sagas/__tests__/checklist-detail.ts | 51 ++++-- .../src/sagas/checklist-detail.ts | 33 ++-- .../src/tests/badges/badge-functions.svg | 2 +- .../src/tests/badges/badge-lines.svg | 2 +- .../src/tests/badges/badge-statements.svg | 2 +- .../src/utils/__tests__/datetime.ts | 8 +- packages/lifetime-legal/src/utils/datetime.ts | 8 +- 22 files changed, 374 insertions(+), 53 deletions(-) diff --git a/packages/elements/src/tests/badges/badge-branches.svg b/packages/elements/src/tests/badges/badge-branches.svg index 2a2c92af4b..5b8985358c 100644 --- a/packages/elements/src/tests/badges/badge-branches.svg +++ b/packages/elements/src/tests/badges/badge-branches.svg @@ -1 +1 @@ - Coverage:branchesCoverage:branches71.03%71.03% \ No newline at end of file + Coverage:branchesCoverage:branches79.97%79.97% \ No newline at end of file diff --git a/packages/elements/src/tests/badges/badge-lines.svg b/packages/elements/src/tests/badges/badge-lines.svg index a21fa65f7a..9d7b4e8a26 100644 --- a/packages/elements/src/tests/badges/badge-lines.svg +++ b/packages/elements/src/tests/badges/badge-lines.svg @@ -1 +1 @@ - Coverage:linesCoverage:lines95.37%95.37% \ No newline at end of file + Coverage:linesCoverage:lines95.9%95.9% \ No newline at end of file diff --git a/packages/elements/src/tests/badges/badge-statements.svg b/packages/elements/src/tests/badges/badge-statements.svg index 449506e357..5c490b762e 100644 --- a/packages/elements/src/tests/badges/badge-statements.svg +++ b/packages/elements/src/tests/badges/badge-statements.svg @@ -1 +1 @@ - Coverage:statementsCoverage:statements95.24%95.24% \ No newline at end of file + Coverage:statementsCoverage:statements95.73%95.73% \ No newline at end of file diff --git a/packages/elements/src/utils/combine-address/__tests__/combine-address.ts b/packages/elements/src/utils/combine-address/__tests__/combine-address.ts index 623301541a..fb7925a1ee 100644 --- a/packages/elements/src/utils/combine-address/__tests__/combine-address.ts +++ b/packages/elements/src/utils/combine-address/__tests__/combine-address.ts @@ -3,14 +3,33 @@ import { combineAddress } from '../combine-address' describe('combineAddress', () => { it('should run correctly', () => { const address = { - buildingName: '', + buildingName: '123', buildingNumber: '65', line1: 'Lindsey Close', line2: 'Great Denham', line3: 'Bedford', line4: 'Bedfordshire', postcode: 'MK40 4GT', - country: '', + country: 'GB', + geolocation: { + latitude: 52.1284, + longitude: -0.507145, + }, + } + const result = combineAddress(address) + const expected = '65 123 Lindsey Close Great Denham Bedford Bedfordshire MK40 4GT' + expect(result).toEqual(expected) + }) + + it('should run correctly 1', () => { + const address = { + buildingNumber: '65', + line1: 'Lindsey Close', + line2: 'Great Denham', + line3: 'Bedford', + line4: 'Bedfordshire', + postcode: 'MK40 4GT', + country: 'GB', geolocation: { latitude: 52.1284, longitude: -0.507145, @@ -20,4 +39,137 @@ describe('combineAddress', () => { const expected = '65 Lindsey Close Great Denham Bedford Bedfordshire MK40 4GT' expect(result).toEqual(expected) }) + + it('should run correctly 2', () => { + const address = { + buildingName: '123', + line1: 'Lindsey Close', + line2: 'Great Denham', + line3: 'Bedford', + line4: 'Bedfordshire', + postcode: 'MK40 4GT', + country: 'GB', + geolocation: { + latitude: 52.1284, + longitude: -0.507145, + }, + } + const result = combineAddress(address) + const expected = ' 123 Lindsey Close Great Denham Bedford Bedfordshire MK40 4GT' + expect(result).toEqual(expected) + }) + + it('should run correctly 3', () => { + const address = { + buildingName: '123', + buildingNumber: '65', + line2: 'Great Denham', + line3: 'Bedford', + line4: 'Bedfordshire', + postcode: 'MK40 4GT', + country: 'GB', + geolocation: { + latitude: 52.1284, + longitude: -0.507145, + }, + } + const result = combineAddress(address) + const expected = '65 123 Great Denham Bedford Bedfordshire MK40 4GT' + expect(result).toEqual(expected) + }) + + it('should run correctly 4', () => { + const address = { + buildingName: '123', + buildingNumber: '65', + line1: 'Lindsey Close', + line3: 'Bedford', + line4: 'Bedfordshire', + postcode: 'MK40 4GT', + country: 'GB', + geolocation: { + latitude: 52.1284, + longitude: -0.507145, + }, + } + const result = combineAddress(address) + const expected = '65 123 Lindsey Close Bedford Bedfordshire MK40 4GT' + expect(result).toEqual(expected) + }) + + it('should run correctly 5', () => { + const address = { + buildingName: '123', + buildingNumber: '65', + line1: 'Lindsey Close', + line2: 'Great Denham', + line4: 'Bedfordshire', + postcode: 'MK40 4GT', + country: 'GB', + geolocation: { + latitude: 52.1284, + longitude: -0.507145, + }, + } + const result = combineAddress(address) + const expected = '65 123 Lindsey Close Great Denham Bedfordshire MK40 4GT' + expect(result).toEqual(expected) + }) + + it('should run correctly 6', () => { + const address = { + buildingName: '123', + buildingNumber: '65', + line1: 'Lindsey Close', + line2: 'Great Denham', + line3: 'Bedford', + postcode: 'MK40 4GT', + country: 'GB', + geolocation: { + latitude: 52.1284, + longitude: -0.507145, + }, + } + const result = combineAddress(address) + const expected = '65 123 Lindsey Close Great Denham Bedford MK40 4GT' + expect(result).toEqual(expected) + }) + + it('should run correctly 7', () => { + const address = { + buildingName: '123', + buildingNumber: '65', + line1: 'Lindsey Close', + line2: 'Great Denham', + line3: 'Bedford', + line4: 'Bedfordshire', + country: 'GB', + geolocation: { + latitude: 52.1284, + longitude: -0.507145, + }, + } + const result = combineAddress(address) + const expected = '65 123 Lindsey Close Great Denham Bedford Bedfordshire' + expect(result).toEqual(expected) + }) + + it('should run correctly 8', () => { + const address = { + buildingName: '123', + buildingNumber: '65', + line1: 'Lindsey Close', + line2: 'Great Denham', + line3: 'Bedford', + line4: 'Bedfordshire', + postcode: 'MK40 4GT', + geolocation: { + latitude: 52.1284, + longitude: -0.507145, + }, + } + const result = combineAddress(address) + const expected = '65 123 Lindsey Close Great Denham Bedford Bedfordshire MK40 4GT' + expect(result).toEqual(expected) + }) }) diff --git a/packages/elements/src/utils/completed-section/__tests__/completed-sections.ts b/packages/elements/src/utils/completed-section/__tests__/completed-sections.ts index bc6e9ae904..eab1b0df59 100644 --- a/packages/elements/src/utils/completed-section/__tests__/completed-sections.ts +++ b/packages/elements/src/utils/completed-section/__tests__/completed-sections.ts @@ -39,7 +39,7 @@ describe('completed-sections', () => { }) it('should run correctly', () => { - const params = null + const params = undefined const result = isCompletedProfile(params) expect(result).toBeFalsy() }) @@ -217,6 +217,118 @@ describe('completed-sections', () => { const result = isCompletedAddress(params) expect(result).toBeTruthy() }) + + it('should run correctly', () => { + const params = { + id: 'BED16000182', + created: '2019-04-18T06:56:07.0000000Z', + title: 'Ms', + forename: 'Cerys', + surname: 'Haldane', + active: true, + marketingConsent: 'notAsked', + source: { + id: '', + type: '', + }, + homePhone: '01632 963892', + workPhone: '020 7946 3892', + mobilePhone: '07700 903892', + email: 'chaldane836@rpsfiction.net', + primaryAddress: { + type: 'primary', + buildingName: '123', + buildingNumber: '102', + line1: 'Holwelbury Road', + line2: '123', + line3: '123', + line4: '123', + postcode: 'SG5 3FL', + countryId: 'GB', + }, + secondaryAddress: { + type: 'secondary', + buildingName: '123', + buildingNumber: '102', + line1: 'Holwelbury Road', + line2: '123', + line3: '123', + line4: '123', + postcode: 'SG5 3FL', + countryId: 'GB', + }, + officeIds: ['BED'], + negotiatorIds: ['JWB'], + _links: { + self: { + href: '/contacts/BED16000182', + }, + documents: { + href: '/documents/?OwnerType=contact&OwnerId=BED16000182', + }, + identityChecks: { + href: '/identityChecks/?ContactId=BED16000182', + }, + }, + } + const result = isCompletedAddress(params) + expect(result).toBeTruthy() + }) + + it('should run correctly', () => { + const params = { + id: 'BED16000182', + created: '2019-04-18T06:56:07.0000000Z', + title: 'Ms', + forename: 'Cerys', + surname: 'Haldane', + active: true, + marketingConsent: 'notAsked', + source: { + id: '', + type: '', + }, + homePhone: '01632 963892', + workPhone: '020 7946 3892', + mobilePhone: '07700 903892', + email: 'chaldane836@rpsfiction.net', + primaryAddress: { + type: 'primary', + buildingName: '123', + buildingNumber: '102', + line1: 'Holwelbury Road', + line2: '123', + line3: '123', + line4: '123', + postcode: 'SG5 3FL', + countryId: 'GB', + }, + secondaryAddress: { + type: 'secondary', + buildingName: '123', + buildingNumber: '102', + line1: 'Holwelbury Road', + line4: '123', + postcode: 'SG5 3FL', + countryId: 'GB', + }, + officeIds: ['BED'], + negotiatorIds: ['JWB'], + _links: { + self: { + href: '/contacts/BED16000182', + }, + documents: { + href: '/documents/?OwnerType=contact&OwnerId=BED16000182', + }, + identityChecks: { + href: '/identityChecks/?ContactId=BED16000182', + }, + }, + } + const result = isCompletedAddress(params) + expect(result).toBeFalsy() + }) }) describe('isCompletedDeclarationRisk', () => { diff --git a/packages/elements/src/utils/completed-section/completed-sections.ts b/packages/elements/src/utils/completed-section/completed-sections.ts index 028ca6a49f..db7e9edbdc 100644 --- a/packages/elements/src/utils/completed-section/completed-sections.ts +++ b/packages/elements/src/utils/completed-section/completed-sections.ts @@ -1,6 +1,6 @@ import { ContactModel, IdentityCheckModel } from '@reapit/foundations-ts-definitions' -export const isCompletedProfile = (contact: ContactModel | null) => { +export const isCompletedProfile = (contact?: ContactModel | null) => { const isValidProfile = contact?.title && contact?.surname && @@ -13,7 +13,7 @@ export const isCompletedProfile = (contact: ContactModel | null) => { return !!isValidProfile } -export const isCompletedPrimaryID = (identityCheck: IdentityCheckModel | null) => { +export const isCompletedPrimaryID = (identityCheck?: IdentityCheckModel | null) => { const isValidIdentityCheck = identityCheck?.identityDocument1?.details && identityCheck?.identityDocument1?.documentId && @@ -22,7 +22,7 @@ export const isCompletedPrimaryID = (identityCheck: IdentityCheckModel | null) = return !!isValidIdentityCheck } -export const isCompletedSecondaryID = (identityCheck: IdentityCheckModel | null) => { +export const isCompletedSecondaryID = (identityCheck?: IdentityCheckModel | null) => { const isValidIdentityCheck = identityCheck?.identityDocument2?.details && identityCheck?.identityDocument2?.documentId && @@ -31,7 +31,7 @@ export const isCompletedSecondaryID = (identityCheck: IdentityCheckModel | null) return !!isValidIdentityCheck } -export const isCompletedAddress = (contact: ContactModel | null) => { +export const isCompletedAddress = (contact?: ContactModel | null) => { const isValidPrimaryAddress = contact?.primaryAddress?.buildingName && contact?.primaryAddress?.buildingNumber && diff --git a/packages/elements/src/utils/datetime/datetime.ts b/packages/elements/src/utils/datetime/datetime.ts index 21b49b3664..6217a532a1 100644 --- a/packages/elements/src/utils/datetime/datetime.ts +++ b/packages/elements/src/utils/datetime/datetime.ts @@ -7,6 +7,7 @@ export const DATE_TIME_FORMAT = { RFC3339: 'YYYY-MM-DDTHH:mm:ssZ', DATE_FORMAT: 'DD MMM YYYY', DATE_TIME_FORMAT: 'DD MMM YYYY HH:mm', + DATE_FORMAT_1: 'YYYY-MM-DD', } export function getTime(date: dayjs.ConfigType, is24HourTime: boolean = false) { diff --git a/packages/elements/src/utils/validators/__tests__/validate-require.ts b/packages/elements/src/utils/validators/__tests__/validate-require.ts index 6ff47c2b07..2a45f2761d 100644 --- a/packages/elements/src/utils/validators/__tests__/validate-require.ts +++ b/packages/elements/src/utils/validators/__tests__/validate-require.ts @@ -62,4 +62,9 @@ describe('fieldValidateRequire', () => { const value = '' expect(fieldValidateRequire(value)).toStrictEqual(errorMessages.FIELD_REQUIRED) }) + + it('work correctly', () => { + const value = '123' + expect(fieldValidateRequire(value)).toBeNull() + }) }) diff --git a/packages/foundations-ts-definitions/types/marketplace-api-schema.ts b/packages/foundations-ts-definitions/types/marketplace-api-schema.ts index f0156578a9..b2c695177a 100644 --- a/packages/foundations-ts-definitions/types/marketplace-api-schema.ts +++ b/packages/foundations-ts-definitions/types/marketplace-api-schema.ts @@ -391,7 +391,6 @@ export interface CreateAppModel { * Sets the apps uri where a user will be redirected to immediately after a successful authentication. Multiple URIs can be passed as a comma separated list */ redirectUris?: string[] - /** * Sets the unique identifer of the developer registering the app */ diff --git a/packages/lifetime-legal/src/components/ui/modal/__tests__/__snapshots__/primary-identification.tsx.snap b/packages/lifetime-legal/src/components/ui/modal/__tests__/__snapshots__/primary-identification.tsx.snap index 79699ac406..ceabd14c9c 100644 --- a/packages/lifetime-legal/src/components/ui/modal/__tests__/__snapshots__/primary-identification.tsx.snap +++ b/packages/lifetime-legal/src/components/ui/modal/__tests__/__snapshots__/primary-identification.tsx.snap @@ -4,7 +4,7 @@ exports[`PrimaryIdentification PrimaryIdentification should match snapshot 1`] = { it('should match a snapshot for desktop login', () => { expect(toJson(shallow())).toMatchSnapshot() }) + + describe('mapDispatchToProps', () => { + it('should run correctly', () => { + const mockDispatch = jest.fn() + const fn = mapDispatchToProps(mockDispatch) + fn.setRefreshSession({ + cognitoClientId: '123', + loginType: 'CLIENT', + mode: 'DESKTOP', + redirectUri: 'https://localhost:8080', + authorizationCode: '123', + refreshToken: '123', + userName: 'tanphamhaiduong@gmail.com', + state: '123', + }) + expect(mockDispatch).toBeCalled() + }) + }) }) diff --git a/packages/lifetime-legal/src/core/private-route-wrapper.tsx b/packages/lifetime-legal/src/core/private-route-wrapper.tsx index 75d5857137..52b0c90d2c 100644 --- a/packages/lifetime-legal/src/core/private-route-wrapper.tsx +++ b/packages/lifetime-legal/src/core/private-route-wrapper.tsx @@ -61,7 +61,7 @@ const mapStateToProps = (state: ReduxState): PrivateRouteWrapperConnectState => hasSession: selectUserLoginStatus(state), }) -const mapDispatchToProps = (dispatch: Dispatch): PrivateRouteWrapperConnectActions => ({ +export const mapDispatchToProps = (dispatch: Dispatch): PrivateRouteWrapperConnectActions => ({ setRefreshSession: refreshParams => dispatch(authSetRefreshSession(refreshParams)), }) diff --git a/packages/lifetime-legal/src/sagas/__stubs__/contact.ts b/packages/lifetime-legal/src/sagas/__stubs__/contact.ts index 468f255bec..f2c6ad7117 100644 --- a/packages/lifetime-legal/src/sagas/__stubs__/contact.ts +++ b/packages/lifetime-legal/src/sagas/__stubs__/contact.ts @@ -42,7 +42,7 @@ export const contact = { officeIds: ['MKC'], negotiatorIds: ['RMK'], metadata: {}, - _eTag: '9CBE436919C6BE89A8642BC70A7CFAEE', + _eTag: '"9CBE436919C6BE89A8642BC70A7CFAEE"', _links: { self: { href: '/contacts/MKC16000007', diff --git a/packages/lifetime-legal/src/sagas/__stubs__/identity-check.ts b/packages/lifetime-legal/src/sagas/__stubs__/identity-check.ts index efd4f719fc..0da5940f99 100644 --- a/packages/lifetime-legal/src/sagas/__stubs__/identity-check.ts +++ b/packages/lifetime-legal/src/sagas/__stubs__/identity-check.ts @@ -21,7 +21,7 @@ export const identityCheck = { details: '12312312', }, metadata: {}, - _eTag: '385DCC877457FA81A5780A4467CE3E5B', + _eTag: '"385DCC877457FA81A5780A4467CE3E5B"', _links: { self: { href: '/identityChecks/RPT20000004', diff --git a/packages/lifetime-legal/src/sagas/__tests__/checklist-detail.ts b/packages/lifetime-legal/src/sagas/__tests__/checklist-detail.ts index 065d26628f..a1964a3166 100644 --- a/packages/lifetime-legal/src/sagas/__tests__/checklist-detail.ts +++ b/packages/lifetime-legal/src/sagas/__tests__/checklist-detail.ts @@ -37,7 +37,7 @@ jest.mock('../../core/store') const mockHeaders = { Authorization: '123', - 'If-Match': '9CBE436919C6BE89A8642BC70A7CFAEE', + 'If-Match': '"385DCC877457FA81A5780A4467CE3E5B"', } describe('check-list detail', () => { @@ -80,7 +80,11 @@ describe('check-list detail', () => { expect(gen.next().value).toEqual(call(initAuthorizedRequestHeaders)) expect(gen.next(mockHeaders).value).toEqual(select(selectContact)) expect(gen.next(contact).value).toEqual( - call(updateContact, { contactId: contact.id, headers: mockHeaders, contact: contact }), + call(updateContact, { + contactId: contact.id, + headers: { ...mockHeaders, 'If-Match': '"9CBE436919C6BE89A8642BC70A7CFAEE"' }, + contact: contact, + }), ) test('api call success', () => { const clone = gen.clone() @@ -117,7 +121,9 @@ describe('check-list detail', () => { }) expect(gen.next().value).toEqual(put(checkListDetailSubmitForm(true))) expect(gen.next().value).toEqual(call(initAuthorizedRequestHeaders)) - expect(gen.next(mockHeaders).value).toEqual(select(selectContact)) + expect(gen.next({ ...mockHeaders, 'If-Match': '"9CBE436919C6BE89A8642BC70A7CFAEE"' }).value).toEqual( + select(selectContact), + ) test('api call success', () => { const clone = gen.clone() @@ -128,10 +134,19 @@ describe('check-list detail', () => { metadata: contact.metadata, } expect(clone.next(contact).value).toEqual( - call(updateContact, { contactId: contact.id, contact: newContact, headers: mockHeaders }), + call(updateContact, { + contactId: contact.id, + contact: newContact, + headers: { ...mockHeaders, 'If-Match': '"9CBE436919C6BE89A8642BC70A7CFAEE"' }, + }), ) expect(clone.next(true).value).toEqual(put(checklistDetailLoading(true))) - expect(clone.next().value).toEqual(call(fetchContact, { contactId: contact.id, headers: mockHeaders })) + expect(clone.next().value).toEqual( + call(fetchContact, { + contactId: contact.id, + headers: { ...mockHeaders, 'If-Match': '"9CBE436919C6BE89A8642BC70A7CFAEE"' }, + }), + ) expect(clone.next(contact).value).toEqual(put(contactReceiveData(contact))) expect(clone.next().value).toEqual(put(checklistDetailLoading(false))) expect(clone.next().value).toEqual(put(checkListDetailSubmitForm(false))) @@ -147,7 +162,11 @@ describe('check-list detail', () => { metadata: contact.metadata, } expect(clone.next(contact).value).toEqual( - call(updateContact, { contactId: contact.id, contact: newContact, headers: mockHeaders }), + call(updateContact, { + contactId: contact.id, + contact: newContact, + headers: { ...mockHeaders, 'If-Match': '"9CBE436919C6BE89A8642BC70A7CFAEE"' }, + }), ) // @ts-ignore expect(clone.throw(new Error(errorMessages.DEFAULT_SERVER_ERROR)).value).toEqual( @@ -185,10 +204,12 @@ describe('checklist-detail updatePrimaryId', () => { headers: mockHeaders, identityCheck: { id: 'RPT20000004', - typeId: '123', - details: '123', - expiry: new Date('2019-10-15T10:00:00Z'), - documentId: 'data:image/jpeg;base64,/9j/4S/+RXhpZgAATU0AKgAAAA', + identityDocument1: { + typeId: '123', + details: '123', + expiry: new Date('2019-10-15T10:00:00Z'), + documentId: 'data:image/jpeg;base64,/9j/4S/+RXhpZgAATU0AKgAAAA', + }, }, }), ) @@ -235,10 +256,12 @@ describe('checklist-detail updateSecondaryId', () => { headers: mockHeaders, identityCheck: { id: 'RPT20000004', - typeId: '123', - details: '123', - expiry: new Date('2019-10-15T10:00:00Z'), - documentId: 'data:image/jpeg;base64,/9j/4S/+RXhpZgAATU0AKgAAAA', + identityDocument2: { + typeId: '123', + details: '123', + expiry: new Date('2019-10-15T10:00:00Z'), + documentId: 'data:image/jpeg;base64,/9j/4S/+RXhpZgAATU0AKgAAAA', + }, }, }), ) diff --git a/packages/lifetime-legal/src/sagas/checklist-detail.ts b/packages/lifetime-legal/src/sagas/checklist-detail.ts index 710580575c..ac7c37029c 100644 --- a/packages/lifetime-legal/src/sagas/checklist-detail.ts +++ b/packages/lifetime-legal/src/sagas/checklist-detail.ts @@ -158,11 +158,13 @@ export const updateSecondaryId = function*({ data }: Action // Updated if existed if (identityCheck) { yield call(updateIdentityCheck, { - headers, + headers: { ...headers, 'If-Match': identityCheck._eTag }, identityCheck: { id: identityCheck.id, - ...data, - documentId: uploaderDocument ? uploaderDocument.Url : data.documentId, + identityDocument1: { + ...data, + documentId: uploaderDocument ? uploaderDocument.Url : data.documentId, + }, }, }) } @@ -228,8 +234,10 @@ export const updatePrimaryId = function*({ data }: Action headers, identityChecks: { contactId: contact.id, - ...data, - documentId: uploaderDocument ? uploaderDocument.Url : data.documentId, + identityDocument1: { + ...data, + documentId: uploaderDocument ? uploaderDocument.Url : data.documentId, + }, status: 'pending', checkDate: toUTCTime(dayjs().startOf('day')), negotiatorId: selectUserCode(store.state), @@ -269,7 +277,10 @@ export const updateAgentCheck = function*({ data }: any) { ...data, }, } - responseUpdate = yield call(updateIdentityCheck, { identityCheck: newIdentityCheck, headers }) + responseUpdate = yield call(updateIdentityCheck, { + identityCheck: newIdentityCheck, + headers: { ...headers, 'If-Match': identityCheck._eTag }, + }) } if (!identityCheck) { const newIdCheck = { diff --git a/packages/lifetime-legal/src/tests/badges/badge-functions.svg b/packages/lifetime-legal/src/tests/badges/badge-functions.svg index 5346d382a9..3c39b8969b 100644 --- a/packages/lifetime-legal/src/tests/badges/badge-functions.svg +++ b/packages/lifetime-legal/src/tests/badges/badge-functions.svg @@ -1 +1 @@ - Coverage:functionsCoverage:functions74.89%74.89% \ No newline at end of file + Coverage:functionsCoverage:functions75.8%75.8% \ No newline at end of file diff --git a/packages/lifetime-legal/src/tests/badges/badge-lines.svg b/packages/lifetime-legal/src/tests/badges/badge-lines.svg index 21b64c7c7c..6a7564649a 100644 --- a/packages/lifetime-legal/src/tests/badges/badge-lines.svg +++ b/packages/lifetime-legal/src/tests/badges/badge-lines.svg @@ -1 +1 @@ - Coverage:linesCoverage:lines88.87%88.87% \ No newline at end of file + Coverage:linesCoverage:lines88.96%88.96% \ No newline at end of file diff --git a/packages/lifetime-legal/src/tests/badges/badge-statements.svg b/packages/lifetime-legal/src/tests/badges/badge-statements.svg index 7c8c086aba..5c97527252 100644 --- a/packages/lifetime-legal/src/tests/badges/badge-statements.svg +++ b/packages/lifetime-legal/src/tests/badges/badge-statements.svg @@ -1 +1 @@ - Coverage:statementsCoverage:statements88.09%88.09% \ No newline at end of file + Coverage:statementsCoverage:statements88.27%88.27% \ No newline at end of file diff --git a/packages/lifetime-legal/src/utils/__tests__/datetime.ts b/packages/lifetime-legal/src/utils/__tests__/datetime.ts index 26a3fef105..ec2a703ef9 100644 --- a/packages/lifetime-legal/src/utils/__tests__/datetime.ts +++ b/packages/lifetime-legal/src/utils/__tests__/datetime.ts @@ -13,7 +13,7 @@ describe('daytime', () => { const { identityDocument1, identityDocument2 } = identityCheck expect(result).toEqual({ ...identityCheck, - checkDate: '2020-01-13T03:00:00+00:00', + checkDate: '2020-01-13', identityDocument1: { ...identityDocument1, expiry: toLocalTime(identityDocument1?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.RFC3339), @@ -36,14 +36,14 @@ describe('daytime', () => { const result = changeTimeZoneUTCForIdentityCheck(identityCheck) expect(result).toEqual({ ...identityCheck, - checkDate: '2020-01-13T03:00:00+00:00', + checkDate: '2020-01-13', identityDocument1: { ...identityDocument1, - expiry: toUTCTime(identityDocument1?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.RFC3339), + expiry: toUTCTime(identityDocument1?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.DATE_FORMAT_1), }, identityDocument2: { ...identityDocument2, - expiry: toUTCTime(identityDocument2?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.RFC3339), + expiry: toUTCTime(identityDocument2?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.DATE_FORMAT_1), }, }) }) diff --git a/packages/lifetime-legal/src/utils/datetime.ts b/packages/lifetime-legal/src/utils/datetime.ts index f671dd731d..acfc982845 100644 --- a/packages/lifetime-legal/src/utils/datetime.ts +++ b/packages/lifetime-legal/src/utils/datetime.ts @@ -18,7 +18,7 @@ export const changeTimeZoneLocalForIdentityCheck = (identityChecks: IdentityChec ...identityDocument2, expiry: toLocalTime(identityDocument2?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.RFC3339), }, - checkDate: toLocalTime(identityChecks.checkDate as dayjs.ConfigType, DATE_TIME_FORMAT.RFC3339), + checkDate: toLocalTime(identityChecks.checkDate as dayjs.ConfigType, DATE_TIME_FORMAT.DATE_FORMAT_1), } } @@ -32,12 +32,12 @@ export const changeTimeZoneUTCForIdentityCheck = (identityChecks: IdentityCheckM ...identityChecks, identityDocument1: { ...identityDocument1, - expiry: toUTCTime(identityDocument1?.expiry as dayjs.ConfigType), + expiry: toUTCTime(identityDocument1?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.DATE_FORMAT_1), }, identityDocument2: { ...identityDocument2, - expiry: toUTCTime(identityDocument2?.expiry as dayjs.ConfigType), + expiry: toUTCTime(identityDocument2?.expiry as dayjs.ConfigType, DATE_TIME_FORMAT.DATE_FORMAT_1), }, - checkDate: toUTCTime(identityChecks.checkDate as dayjs.ConfigType), + checkDate: toUTCTime(identityChecks.checkDate as dayjs.ConfigType, DATE_TIME_FORMAT.DATE_FORMAT_1), } }