Skip to content

Commit

Permalink
test suite created for qt/review
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlovesgithub committed Oct 6, 2020
1 parent 76cfbfe commit 2c82599
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
Correct: {{ testQuestion.options[testQuestion.correct].answer }}
</div>
<div
class="govuk-!-padding-1"
v-if="isScenario"
class="govuk-!-padding-1"
>
<div
v-for="(document, docNum) in testQuestion.documents"
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const mocks = {
auth: {
currentUser: {
role: 'superadmin',
}
},
},
vacancy: {
record: {
Expand All @@ -43,6 +43,10 @@ const mocks = {
title: null,
},
},
qualifyingTestResponses: {
record: {
},
},
},
getters: {
'vacancy/getCloseDate': new Date(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import Review from '@/views/Exercises/Tasks/QualifyingTests/QualifyingTest/Review.vue';
import { createTestSubject } from '@/../tests/unit/helpers';

const mockCandidate = {
fullName: 'Mock Name',
email: 'mock@email.address',
id: '00001',
reasonableAdjustments: true,
reasonableAdjustmentsDetails: 'abc',
};

const mockTestQuestions = {
introduction: 'Hello',
questions: [
Expand All @@ -19,26 +27,82 @@ const mockTestQuestions = {
};

const mockQualifyingTest = {
title: 'mockQtTitle',
id: '1111',
mode: 'mode',
type: 'critical-analysis',
status: 'started',
startDate: new Date('111'),
endDate: new Date('222'),
testDuration: 222,
additionalInstructions: [
{
text: 'one',
record: {
id: '1111',
title: 'mockQtTitle',
startDate: new Date('111'),
endDate: new Date('222'),
additionalInstructions: [
{
text: 'one',
},
{
text: 'two',
},
],
feedbackSurvey: 'URL/string',
application: {
id: 'asdfhkj1234',
referenceNumber: 'JAC1234-qwe1234',
},
candidate: mockCandidate,
mode: 'mode',
type: 'critical-analysis',
status: 'started',
testDuration: 222,
testQuestions: mockTestQuestions,
},
};

const mockQualifyingTestResponses = {
record: [
{
text: 'two',
application: {
id: 'testData-72',
referenceNumber: 'testData-72',
},
candidate: mockCandidate,
duration: {
reasonableAdjustment: 0,
testDuration: 60,
testDurationAdjusted: 60,
},
lastUpdated: new Date('333'),
qualifyingTest: {
id: '1111',
title: 'mockQtTitle',
startDate: new Date('111'),
endDate: new Date('222'),
additionalInstructions: [
{
text: 'one',
},
{
text: 'two',
},
],
feedbackSurvey: 'URL/string',
application: {
id: 'asdfhkj1234',
referenceNumber: 'JAC1234-qwe1234',
},
mode: 'mode',
type: 'critical-analysis',
status: 'started',
testDuration: 222,
},
responses: {

},
testQuestions: mockTestQuestions,
vacancy: {
id: 'wdpALbyICL7ZxxN5AQt8',
},
},
],
testQuestions: mockTestQuestions,
};

describe('@/views/Exercises/Tasks/QualifyingTests/QualifyingTest/Review', () => {
xdescribe('@/views/Exercises/Tasks/QualifyingTests/QualifyingTest/Review', () => {

describe('component instance', () => {
let wrapper;
Expand All @@ -51,11 +115,12 @@ describe('@/views/Exercises/Tasks/QualifyingTests/QualifyingTest/Review', () =>
},
});
wrapper.vm.$store.state.qualifyingTest.record = mockQualifyingTest;
wrapper.vm.$store.state.qualifyingTestResponses = mockQualifyingTestResponses;
wrapper.vm.$store.state.candidate = mockQualifyingTestResponses.candidate;
});

describe('template', () => {
it('renders the component', () => {
console.log(wrapper.html());
expect(wrapper.exists()).toBe(true);
});
});
Expand Down

0 comments on commit 2c82599

Please sign in to comment.