Skip to content

Commit

Permalink
More tests for other details
Browse files Browse the repository at this point in the history
  • Loading branch information
warrensearle authored and YaaL committed Apr 27, 2020
1 parent 3b84c92 commit 81f708e
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/unit/views/Exercises/Show/Applications.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,26 @@ describe('@/views/Exercises/Show/Applications', () => {
expect(flattened).toEqual(expect.stringContaining('Barrister'));
expect(flattened).toEqual(expect.stringContaining(mockApplication.equalityAndDiversitySurvey.otherCurrentLegalRoleDetails));
});

it('only returns otherCurrentLegalRoleDetails when other has been selected', () => {
let flattened = wrapper.vm.flattenCurrentLegalRole({
currentLegalRole: [
'barrister',
],
otherCurrentLegalRoleDetails: 'mock role details',
});
expect(flattened).toBe('"Barrister"');
flattened = wrapper.vm.flattenCurrentLegalRole({
currentLegalRole: [
'barrister',
'other-current-legal-role',
],
otherCurrentLegalRoleDetails: 'mock role details',
});
expect(flattened).toEqual(expect.stringContaining('Barrister'));
expect(flattened).toEqual(expect.stringContaining('mock role details'));
});

});

describe('flattenProfessionalBackground', () => {
Expand All @@ -196,6 +216,26 @@ describe('@/views/Exercises/Show/Applications', () => {
expect(flattened).toEqual(expect.stringContaining('Solicitor'));
expect(flattened).toEqual(expect.stringContaining(mockApplication.equalityAndDiversitySurvey.otherProfessionalBackgroundDetails));
});

it('only returns otherProfessionalBackgroundDetails when other has been selected', () => {
let flattened = wrapper.vm.flattenProfessionalBackground({
professionalBackground: [
'solicitor',
],
otherProfessionalBackgroundDetails: 'mock background details',
});
expect(flattened).toBe('"Solicitor"');
flattened = wrapper.vm.flattenProfessionalBackground({
professionalBackground: [
'solicitor',
'other-professional-background',
],
otherProfessionalBackgroundDetails: 'mock background details',
});
expect(flattened).toEqual(expect.stringContaining('Solicitor'));
expect(flattened).toEqual(expect.stringContaining('mock background details'));
});

});

describe('attendedUKStateSchool()', () => {
Expand Down

0 comments on commit 81f708e

Please sign in to comment.