@digabi/exam-engine-mastering 16.1.1 → 16.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/testExamMastering.js +53 -31
- package/dist/__tests__/testExamMastering.js.map +1 -1
- package/dist/__tests__/testMexCreation.js +3 -3
- package/dist/__tests__/testMexCreation.js.map +1 -1
- package/dist/__tests__/testMigrations.js +14 -14
- package/dist/__tests__/testMigrations.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/createMex.js +8 -8
- package/dist/createMex.js.map +1 -1
- package/dist/getMediaMetadataFromLocalFile.js +1 -1
- package/dist/getMediaMetadataFromLocalFile.js.map +1 -1
- package/dist/i18n/exam_titles_sv-FI.json +1 -1
- package/dist/mastering/createGradingStructure.js +11 -11
- package/dist/mastering/createGradingStructure.js.map +1 -1
- package/dist/mastering/index.d.ts.map +1 -1
- package/dist/mastering/index.js +68 -49
- package/dist/mastering/index.js.map +1 -1
- package/package.json +4 -4
- package/schema/exam.xsd +57 -2
|
@@ -14,30 +14,52 @@ const fixtures_1 = require("./fixtures");
|
|
|
14
14
|
const generateUuid = () => '00000000-0000-0000-0000-000000000000';
|
|
15
15
|
const getMediaMetadata = async (__, type) => Promise.resolve(type === 'audio' ? { duration: 999 } : { width: 999, height: 999 });
|
|
16
16
|
describe('Exam mastering', () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
describe('throws an error if', () => {
|
|
18
|
+
it('XML is invalid', async () => {
|
|
19
|
+
const xml = await (0, fixtures_1.readFixture)('not_xml.xml');
|
|
20
|
+
return expect((0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata)).rejects.toThrow("Start tag expected, '<' not found\n");
|
|
21
|
+
});
|
|
22
|
+
it('XML has invalid exam code', async () => {
|
|
23
|
+
const xml = await (0, fixtures_1.readFixture)('invalid_exam_code.xml');
|
|
24
|
+
return expect((0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata)).rejects.toThrow('Invalid exam-code BI for day-code X');
|
|
25
|
+
});
|
|
26
|
+
it('XML has invalid day code', async () => {
|
|
27
|
+
const xml = await (0, fixtures_1.readFixture)('invalid_day_code.xml');
|
|
28
|
+
return expect((0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata)).rejects.toThrow("The value 'Z' is not an element of the set");
|
|
29
|
+
});
|
|
30
|
+
it('XML has invalid empty day code', async () => {
|
|
31
|
+
const xml = await (0, fixtures_1.readFixture)('invalid_empty_day_code.xml');
|
|
32
|
+
return expect((0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata)).rejects.toThrow('Invalid empty day-code for exam-code A');
|
|
33
|
+
});
|
|
20
34
|
});
|
|
21
35
|
it('validates the XML against a schema', async () => {
|
|
22
|
-
const xml = await fixtures_1.readFixture('does_not_validate.xml');
|
|
23
|
-
return expect(exam_engine_mastering_1.masterExam(xml, generateUuid, getMediaMetadata)).rejects.toThrow("Element '{http://ylioppilastutkinto.fi/exam.xsd}exam-title': This element is not expected. Expected is ( {http://ylioppilastutkinto.fi/exam.xsd}exam-versions ).\n");
|
|
36
|
+
const xml = await (0, fixtures_1.readFixture)('does_not_validate.xml');
|
|
37
|
+
return expect((0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata)).rejects.toThrow("Element '{http://ylioppilastutkinto.fi/exam.xsd}exam-title': This element is not expected. Expected is ( {http://ylioppilastutkinto.fi/exam.xsd}exam-versions ).\n");
|
|
24
38
|
});
|
|
25
39
|
it('does not substitute entities', async () => {
|
|
26
|
-
const xml = await fixtures_1.readFixture('has_entities.xml');
|
|
27
|
-
return expect(exam_engine_mastering_1.masterExam(xml, generateUuid, getMediaMetadata)).rejects.toThrow('Internal error: xmlSchemaVDocWalk, there is at least one entity reference in the node-tree currently being validated. Processing of entities with this XML Schema processor is not supported (yet). Please substitute entities before validation..\n');
|
|
40
|
+
const xml = await (0, fixtures_1.readFixture)('has_entities.xml');
|
|
41
|
+
return expect((0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata)).rejects.toThrow('Internal error: xmlSchemaVDocWalk, there is at least one entity reference in the node-tree currently being validated. Processing of entities with this XML Schema processor is not supported (yet). Please substitute entities before validation..\n');
|
|
28
42
|
});
|
|
29
43
|
it('validates that all answers are directly under a question', async () => {
|
|
30
|
-
const xml = await fixtures_1.readFixture('answer_not_under_question.xml');
|
|
31
|
-
return expect(exam_engine_mastering_1.masterExam(xml, generateUuid, getMediaMetadata)).rejects.toThrow('All answers must be within a question.');
|
|
44
|
+
const xml = await (0, fixtures_1.readFixture)('answer_not_under_question.xml');
|
|
45
|
+
return expect((0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata)).rejects.toThrow('All answers must be within a question.');
|
|
32
46
|
});
|
|
33
47
|
it('validates that a question may not contain both answers and child questions', async () => {
|
|
34
|
-
const xml = await fixtures_1.readFixture('question_containing_both_subquestions_and_answers.xml');
|
|
35
|
-
return expect(exam_engine_mastering_1.masterExam(xml, generateUuid, getMediaMetadata)).rejects.toThrow('A question may not contain both answer elements and child questions');
|
|
48
|
+
const xml = await (0, fixtures_1.readFixture)('question_containing_both_subquestions_and_answers.xml');
|
|
49
|
+
return expect((0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata)).rejects.toThrow('A question may not contain both answer elements and child questions');
|
|
50
|
+
});
|
|
51
|
+
it('validates that a scored-text-answer must have either a max-score attribute or an accepted-answer', async () => {
|
|
52
|
+
const xml = await (0, fixtures_1.readFixture)('accepted_answer_without_score.xml');
|
|
53
|
+
return expect((0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata)).rejects.toThrow('A scored-text-answer element must contain either a max-score attribute or contain accepted-answers');
|
|
54
|
+
});
|
|
55
|
+
it('validates that the max-score of a scored-text-answer is not smaller than the score of its accepted-answer', async () => {
|
|
56
|
+
const xml = await (0, fixtures_1.readFixture)('accepted_answer_with_too_high_score.xml');
|
|
57
|
+
return expect((0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata)).rejects.toThrow('The max-score of a scored-text-answer cannot be smaller than the score of some of its accepted-answers');
|
|
36
58
|
});
|
|
37
59
|
it('calls generateUuid with exam metadata if it is an yo exam', async () => {
|
|
38
|
-
const xml = await fixtures_1.readFixture('minimal_yo_exam.xml');
|
|
60
|
+
const xml = await (0, fixtures_1.readFixture)('minimal_yo_exam.xml');
|
|
39
61
|
const spy = jest.fn(generateUuid);
|
|
40
|
-
await exam_engine_mastering_1.masterExam(xml, spy, getMediaMetadata);
|
|
62
|
+
await (0, exam_engine_mastering_1.masterExam)(xml, spy, getMediaMetadata);
|
|
41
63
|
expect(spy).toHaveBeenCalledTimes(2);
|
|
42
64
|
expect(spy.mock.calls[0]).toEqual([
|
|
43
65
|
{
|
|
@@ -57,8 +79,8 @@ describe('Exam mastering', () => {
|
|
|
57
79
|
]);
|
|
58
80
|
});
|
|
59
81
|
it('combines choice-answers and dropdown-answers to the same question in grading structure', async () => {
|
|
60
|
-
const xml = exam_engine_generator_1.generateExam({ sections: [{ questions: [exam_engine_generator_1.question([exam_engine_generator_1.choiceAnswer(), exam_engine_generator_1.dropdownAnswer()])] }] });
|
|
61
|
-
const [masteringResult] = await exam_engine_mastering_1.masterExam(xml, generateUuid, getMediaMetadata);
|
|
82
|
+
const xml = (0, exam_engine_generator_1.generateExam)({ sections: [{ questions: [(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.choiceAnswer)(), (0, exam_engine_generator_1.dropdownAnswer)()])] }] });
|
|
83
|
+
const [masteringResult] = await (0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata);
|
|
62
84
|
expect(masteringResult.gradingStructure.questions).toMatchObject([
|
|
63
85
|
{
|
|
64
86
|
type: 'choicegroup',
|
|
@@ -71,27 +93,27 @@ describe('Exam mastering', () => {
|
|
|
71
93
|
]);
|
|
72
94
|
});
|
|
73
95
|
it('supports arbitrarily nested questions', async () => {
|
|
74
|
-
const xml = exam_engine_generator_1.generateExam({
|
|
96
|
+
const xml = (0, exam_engine_generator_1.generateExam)({
|
|
75
97
|
sections: [
|
|
76
98
|
{
|
|
77
99
|
questions: [
|
|
78
|
-
exam_engine_generator_1.question([exam_engine_generator_1.question([exam_engine_generator_1.textAnswer()]), exam_engine_generator_1.question([exam_engine_generator_1.textAnswer()])]),
|
|
79
|
-
exam_engine_generator_1.question([exam_engine_generator_1.question([exam_engine_generator_1.question([exam_engine_generator_1.textAnswer()]), exam_engine_generator_1.question([exam_engine_generator_1.textAnswer()])])]),
|
|
80
|
-
exam_engine_generator_1.question([exam_engine_generator_1.question([exam_engine_generator_1.question([exam_engine_generator_1.question([exam_engine_generator_1.textAnswer()]), exam_engine_generator_1.question([exam_engine_generator_1.textAnswer()])])])]),
|
|
100
|
+
(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.textAnswer)()]), (0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.textAnswer)()])]),
|
|
101
|
+
(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.textAnswer)()]), (0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.textAnswer)()])])]),
|
|
102
|
+
(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.textAnswer)()]), (0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.textAnswer)()])])])]),
|
|
81
103
|
],
|
|
82
104
|
},
|
|
83
105
|
],
|
|
84
106
|
});
|
|
85
|
-
const [masteringResult] = await exam_engine_mastering_1.masterExam(xml, generateUuid, getMediaMetadata);
|
|
86
|
-
expect(jest_snapshot_serializer_raw_1.wrap(masteringResult.xml)).toMatchSnapshot('xml');
|
|
107
|
+
const [masteringResult] = await (0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata);
|
|
108
|
+
expect((0, jest_snapshot_serializer_raw_1.wrap)(masteringResult.xml)).toMatchSnapshot('xml');
|
|
87
109
|
});
|
|
88
110
|
it('shuffles choice answers but keeps no-answer options last', async () => {
|
|
89
|
-
const xml = await fixtures_1.readFixture('choice_answer_with_no_answer.xml');
|
|
90
|
-
const [masteringResult] = await exam_engine_mastering_1.masterExam(xml, generateUuid, getMediaMetadata);
|
|
91
|
-
expect(jest_snapshot_serializer_raw_1.wrap(masteringResult.xml)).toMatchSnapshot();
|
|
111
|
+
const xml = await (0, fixtures_1.readFixture)('choice_answer_with_no_answer.xml');
|
|
112
|
+
const [masteringResult] = await (0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata);
|
|
113
|
+
expect((0, jest_snapshot_serializer_raw_1.wrap)(masteringResult.xml)).toMatchSnapshot();
|
|
92
114
|
});
|
|
93
115
|
it('adds a suffix to exam title for special exams', async () => {
|
|
94
|
-
const xml = exam_engine_generator_1.generateExam({
|
|
116
|
+
const xml = (0, exam_engine_generator_1.generateExam)({
|
|
95
117
|
examCode: 'EA',
|
|
96
118
|
examVersions: [
|
|
97
119
|
{ language: 'fi-FI', type: 'normal' },
|
|
@@ -100,11 +122,11 @@ describe('Exam mastering', () => {
|
|
|
100
122
|
],
|
|
101
123
|
sections: [
|
|
102
124
|
{
|
|
103
|
-
questions: [exam_engine_generator_1.question([exam_engine_generator_1.textAnswer()])],
|
|
125
|
+
questions: [(0, exam_engine_generator_1.question)([(0, exam_engine_generator_1.textAnswer)()])],
|
|
104
126
|
},
|
|
105
127
|
],
|
|
106
128
|
});
|
|
107
|
-
const masteringResults = await exam_engine_mastering_1.masterExam(xml, generateUuid, getMediaMetadata);
|
|
129
|
+
const masteringResults = await (0, exam_engine_mastering_1.masterExam)(xml, generateUuid, getMediaMetadata);
|
|
108
130
|
const titles = masteringResults.map((r) => r.title);
|
|
109
131
|
expect(titles).toEqual([
|
|
110
132
|
'FI – Englanti, pitkä oppimäärä',
|
|
@@ -112,13 +134,13 @@ describe('Exam mastering', () => {
|
|
|
112
134
|
'FI – Englanti, pitkä oppimäärä (kuulovammaiset)',
|
|
113
135
|
]);
|
|
114
136
|
});
|
|
115
|
-
for (const exam of exam_engine_exams_1.listExams()) {
|
|
137
|
+
for (const exam of (0, exam_engine_exams_1.listExams)()) {
|
|
116
138
|
it(`masters ${path_1.default.basename(exam)} exam correctly`, async () => {
|
|
117
139
|
const source = await fs_1.promises.readFile(exam, 'utf-8');
|
|
118
|
-
const results = await exam_engine_mastering_1.masterExam(source, generateUuid, getMediaMetadata);
|
|
140
|
+
const results = await (0, exam_engine_mastering_1.masterExam)(source, generateUuid, getMediaMetadata);
|
|
119
141
|
for (const result of results) {
|
|
120
|
-
expect(jest_snapshot_serializer_raw_1.wrap(result.xml)).toMatchSnapshot('xml');
|
|
121
|
-
expect(jest_snapshot_serializer_raw_1.wrap(result.translation)).toMatchSnapshot('translation');
|
|
142
|
+
expect((0, jest_snapshot_serializer_raw_1.wrap)(result.xml)).toMatchSnapshot('xml');
|
|
143
|
+
expect((0, jest_snapshot_serializer_raw_1.wrap)(result.translation)).toMatchSnapshot('translation');
|
|
122
144
|
expect(lodash_1.default.omit(result, 'xml', 'translation')).toMatchSnapshot();
|
|
123
145
|
}
|
|
124
146
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testExamMastering.js","sourceRoot":"","sources":["../../__tests__/testExamMastering.ts"],"names":[],"mappings":";;;;;AAAA,iEAAqD;AACrD,yEAAgH;AAChH,yEAA0F;AAC1F,2BAAmC;AACnC,+EAAmD;AACnD,oDAAsB;AACtB,gDAAuB;AACvB,yCAAwC;AAExC,MAAM,YAAY,GAAiB,GAAG,EAAE,CAAC,sCAAsC,CAAA;AAC/E,MAAM,gBAAgB,GAAqB,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,CAC5D,OAAO,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EA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CAAC,WAAW,cAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;YAC7D,MAAM,MAAM,GAAG,MAAM,aAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YAC/C,MAAM,OAAO,GAAG,MAAM,IAAA,kCAAU,EAAC,MAAM,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAA;YACxE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;gBAC5B,MAAM,CAAC,IAAA,mCAAI,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;gBAC/C,MAAM,CAAC,IAAA,mCAAI,EAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,aAAa,CAAC,CAAA;gBAC/D,MAAM,CAAC,gBAAC,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;aAC/D;QACH,CAAC,CAAC,CAAA;KACH;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -56,7 +56,7 @@ describe('Mex exam package creation', () => {
|
|
|
56
56
|
describe('with createMex', () => {
|
|
57
57
|
async function expectCorrectMexIsCreated(koeUpdate) {
|
|
58
58
|
const { mexStream, mexBuffers } = getMexStreamAndBuffers();
|
|
59
|
-
await createMex_1.createMex(xml, attachments, nsaScripts, null, passphrase, privateKey, mexStream, undefined, ktpUpdate, koeUpdate);
|
|
59
|
+
await (0, createMex_1.createMex)(xml, attachments, nsaScripts, null, passphrase, privateKey, mexStream, undefined, ktpUpdate, koeUpdate);
|
|
60
60
|
return await expectZipEntriesAreCorrect(mexBuffers, (e) => ({
|
|
61
61
|
fileName: e.fileName,
|
|
62
62
|
uncompressedSize: e.fileName === 'rendering.zip.bin' ? 0 : e.uncompressedSize, // ignore rendering.zip size
|
|
@@ -66,7 +66,7 @@ describe('Mex exam package creation', () => {
|
|
|
66
66
|
const mexEntries = await expectCorrectMexIsCreated();
|
|
67
67
|
const encryptedExamXml = await toBuffer(await mexEntries.find((e) => e.fileName === 'exam.xml.bin').openReadStream());
|
|
68
68
|
const encryptedExamXmlSignature = (await toBuffer(await mexEntries.find((e) => e.fileName === 'exam.xml.bin.sig').openReadStream())).toString('utf8');
|
|
69
|
-
const signatureVerificationResult = crypto_utils_1.verifyWithSHA256AndRSA(encryptedExamXml, publicKey, encryptedExamXmlSignature);
|
|
69
|
+
const signatureVerificationResult = (0, crypto_utils_1.verifyWithSHA256AndRSA)(encryptedExamXml, publicKey, encryptedExamXmlSignature);
|
|
70
70
|
expect(signatureVerificationResult).toBeTruthy();
|
|
71
71
|
});
|
|
72
72
|
it('creates a mex with koe-update.zip', async () => {
|
|
@@ -77,7 +77,7 @@ describe('Mex exam package creation', () => {
|
|
|
77
77
|
describe('with createMultiMex', () => {
|
|
78
78
|
async function expectCorrectMultiMexIsCreated(koeUpdate) {
|
|
79
79
|
const { mexStream, mexBuffers } = getMexStreamAndBuffers();
|
|
80
|
-
await createMex_1.createMultiMex(exams, nsaScripts, securityCodes, passphrase, privateKey, mexStream, loadSimulationConfiguration, ktpUpdate, koeUpdate);
|
|
80
|
+
await (0, createMex_1.createMultiMex)(exams, nsaScripts, securityCodes, passphrase, privateKey, mexStream, loadSimulationConfiguration, ktpUpdate, koeUpdate);
|
|
81
81
|
await expectZipEntriesAreCorrect(mexBuffers, (e) => ({
|
|
82
82
|
fileName: e.fileName,
|
|
83
83
|
uncompressedSize: e.uncompressedSize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testMexCreation.js","sourceRoot":"","sources":["../../__tests__/testMexCreation.ts"],"names":[],"mappings":";;;;;AAAA,2BAAmC;AACnC,gDAAuB;AACvB,kEAAiC;AACjC,mCAA8C;AAC9C,iDAAuF;AACvF,sDAA4D;AAO5D,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAI,UAAkB,CAAA;IACt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OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,OAAO,GAAa,EAAE,CAAA;QAC5B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QACzC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -5,26 +5,26 @@ const fixtures_1 = require("./fixtures");
|
|
|
5
5
|
const jest_snapshot_serializer_raw_1 = require("jest-snapshot-serializer-raw");
|
|
6
6
|
describe('Exam migrations', () => {
|
|
7
7
|
it('migrates an old exam to the current schema', async () => {
|
|
8
|
-
const xml = await fixtures_1.readFixture('old_schema_version.xml');
|
|
9
|
-
const doc = exam_engine_mastering_1.parseExam(xml, false);
|
|
10
|
-
exam_engine_mastering_1.migrateExam(doc);
|
|
11
|
-
expect(jest_snapshot_serializer_raw_1.wrap(doc.toString(false))).toMatchSnapshot();
|
|
8
|
+
const xml = await (0, fixtures_1.readFixture)('old_schema_version.xml');
|
|
9
|
+
const doc = (0, exam_engine_mastering_1.parseExam)(xml, false);
|
|
10
|
+
(0, exam_engine_mastering_1.migrateExam)(doc);
|
|
11
|
+
expect((0, jest_snapshot_serializer_raw_1.wrap)(doc.toString(false))).toMatchSnapshot();
|
|
12
12
|
});
|
|
13
13
|
it('does nothing if the exam already is in the latest schema', async () => {
|
|
14
|
-
const xml = await fixtures_1.readFixture('minimal_yo_exam.xml');
|
|
15
|
-
const doc = exam_engine_mastering_1.parseExam(xml);
|
|
16
|
-
exam_engine_mastering_1.migrateExam(doc);
|
|
17
|
-
expect(doc.toString(false)).toEqual(exam_engine_mastering_1.parseExam(xml).toString(false));
|
|
14
|
+
const xml = await (0, fixtures_1.readFixture)('minimal_yo_exam.xml');
|
|
15
|
+
const doc = (0, exam_engine_mastering_1.parseExam)(xml);
|
|
16
|
+
(0, exam_engine_mastering_1.migrateExam)(doc);
|
|
17
|
+
expect(doc.toString(false)).toEqual((0, exam_engine_mastering_1.parseExam)(xml).toString(false));
|
|
18
18
|
});
|
|
19
19
|
it('throws an error if schema version is invalid', async () => {
|
|
20
|
-
const xml = await fixtures_1.readFixture('invalid_schema_version.xml');
|
|
21
|
-
const doc = exam_engine_mastering_1.parseExam(xml);
|
|
22
|
-
expect(() => exam_engine_mastering_1.migrateExam(doc)).toThrow('Unsupported exam schema version: 2.0');
|
|
20
|
+
const xml = await (0, fixtures_1.readFixture)('invalid_schema_version.xml');
|
|
21
|
+
const doc = (0, exam_engine_mastering_1.parseExam)(xml);
|
|
22
|
+
expect(() => (0, exam_engine_mastering_1.migrateExam)(doc)).toThrow('Unsupported exam schema version: 2.0');
|
|
23
23
|
});
|
|
24
24
|
it('throws an error if schema version is missing', async () => {
|
|
25
|
-
const xml = await fixtures_1.readFixture('no_schema_version.xml');
|
|
26
|
-
const doc = exam_engine_mastering_1.parseExam(xml);
|
|
27
|
-
expect(() => exam_engine_mastering_1.migrateExam(doc)).toThrow('No exam-schema-version attribute found');
|
|
25
|
+
const xml = await (0, fixtures_1.readFixture)('no_schema_version.xml');
|
|
26
|
+
const doc = (0, exam_engine_mastering_1.parseExam)(xml);
|
|
27
|
+
expect(() => (0, exam_engine_mastering_1.migrateExam)(doc)).toThrow('No exam-schema-version attribute found');
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
//# sourceMappingURL=testMigrations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testMigrations.js","sourceRoot":"","sources":["../../__tests__/testMigrations.ts"],"names":[],"mappings":";;AAAA,yEAAsE;AACtE,yCAAwC;AACxC,+EAAmD;AAEnD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI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