Initial API tests

This commit is contained in:
Jonathan Putney
2019-11-13 23:07:28 -05:00
parent ed57b705b1
commit 6dc512ba1f
8 changed files with 136 additions and 75 deletions

View File

@@ -6,7 +6,7 @@ import {
CMIEvaluationCommentsObject,
CMITriesObject, NAV,
} from '../../src/cmi/aicc_cmi';
import * as h from '../helpers';
import * as h from '../cmi_helpers';
import {
CMIInteractionsObject,
CMIObjectivesObject,
@@ -29,13 +29,13 @@ describe('AICC CMI Tests', () => {
/**
* Base CMI Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi._version',
expectedValue: '3.4',
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi._children',
expectedValue: aicc_constants.cmi_children,
@@ -64,7 +64,7 @@ describe('AICC CMI Tests', () => {
/**
* cmi.core Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.core._children',
expectedValue: aicc_constants.core_children,
@@ -139,7 +139,7 @@ describe('AICC CMI Tests', () => {
/**
* cmi.core.score Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.core.score._children',
expectedValue: aicc_constants.score_children,
@@ -168,13 +168,13 @@ describe('AICC CMI Tests', () => {
/**
* cmi.objectives Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.objectives._children',
expectedValue: aicc_constants.objectives_children,
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.objectives._count', expectedValue: 0,
expectedError: invalid_set,
@@ -183,7 +183,7 @@ describe('AICC CMI Tests', () => {
/**
* cmi.student_data Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.student_data._children',
expectedValue: aicc_constants.student_data_children,
@@ -209,7 +209,7 @@ describe('AICC CMI Tests', () => {
/**
* cmi.student_preference Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.student_preference._children',
expectedValue: aicc_constants.student_preference_children,
@@ -245,13 +245,13 @@ describe('AICC CMI Tests', () => {
/**
* cmi.interactions Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.interactions._children',
expectedValue: aicc_constants.interactions_children,
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.interactions._count', expectedValue: 0,
expectedError: invalid_set,
@@ -268,13 +268,13 @@ describe('AICC CMI Tests', () => {
/**
* Base CMI Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi._version',
expectedValue: '3.4',
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi._children',
expectedValue: aicc_constants.cmi_children,
@@ -304,7 +304,7 @@ describe('AICC CMI Tests', () => {
/**
* cmi.core Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.core._children',
expectedValue: aicc_constants.core_children,
@@ -384,7 +384,7 @@ describe('AICC CMI Tests', () => {
/**
* cmi.core.score Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.core.score._children',
expectedValue: aicc_constants.score_children,
@@ -412,13 +412,13 @@ describe('AICC CMI Tests', () => {
/**
* cmi.objectives Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.objectives._children',
expectedValue: aicc_constants.objectives_children,
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.objectives._count', expectedValue: 0,
expectedError: invalid_set,
@@ -427,7 +427,7 @@ describe('AICC CMI Tests', () => {
/**
* cmi.student_data Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.student_data._children',
expectedValue: aicc_constants.student_data_children,
@@ -457,7 +457,7 @@ describe('AICC CMI Tests', () => {
/**
* cmi.student_preference Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.student_preference._children',
expectedValue: aicc_constants.student_preference_children,
@@ -493,13 +493,13 @@ describe('AICC CMI Tests', () => {
/**
* cmi.interactions Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.interactions._children',
expectedValue: aicc_constants.interactions_children,
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.interactions._count', expectedValue: 0,
expectedError: invalid_set,
@@ -566,7 +566,7 @@ describe('AICC CMI Tests', () => {
/**
* cmi.student_data.tries.n.score Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: triesObject(),
fieldName: 'cmi.score._children',
expectedValue: aicc_constants.score_children,

View File

@@ -9,7 +9,7 @@ import {
CMIInteractionsObjectivesObject,
CMIObjectivesObject,
} from '../../src/cmi/scorm12_cmi';
import * as h from '../helpers';
import * as h from '../cmi_helpers';
import {scorm12_values} from '../../src/constants/field_values';
const invalid_set = scorm12_error_codes.INVALID_SET_VALUE;
@@ -27,13 +27,13 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* Base CMI Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi._version',
expectedValue: '3.4',
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi._children',
expectedValue: scorm12_constants.cmi_children,
@@ -63,7 +63,7 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.core Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.core._children',
expectedValue: scorm12_constants.core_children,
@@ -137,7 +137,7 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.core.score Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.core.score._children',
expectedValue: scorm12_constants.score_children,
@@ -178,13 +178,13 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.objectives Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.objectives._children',
expectedValue: scorm12_constants.objectives_children,
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.objectives._count',
expectedValue: 0,
@@ -194,7 +194,7 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.student_data Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.student_data._children',
expectedValue: scorm12_constants.student_data_children,
@@ -216,7 +216,7 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.student_preference Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.student_preference._children',
expectedValue: scorm12_constants.student_preference_children,
@@ -264,13 +264,13 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.interactions Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.interactions._children',
expectedValue: scorm12_constants.interactions_children,
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.interactions._count',
expectedValue: 0,
@@ -288,13 +288,13 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* Base CMI Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi._version',
expectedValue: '3.4',
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi._children',
expectedValue: scorm12_constants.cmi_children,
@@ -326,7 +326,7 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.core Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.core._children',
expectedValue: scorm12_constants.core_children,
@@ -406,7 +406,7 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.core.score Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.core.score._children',
expectedValue: scorm12_constants.score_children,
@@ -434,13 +434,13 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.objectives Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.objectives._children',
expectedValue: scorm12_constants.objectives_children,
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.objectives._count',
expectedValue: 0,
@@ -450,7 +450,7 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.student_data Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.student_data._children',
expectedValue: scorm12_constants.student_data_children,
@@ -475,7 +475,7 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.student_preference Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.student_preference._children',
expectedValue: scorm12_constants.student_preference_children,
@@ -509,13 +509,13 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.interactions Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.interactions._children',
expectedValue: scorm12_constants.interactions_children,
expectedError: invalid_set,
});
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.interactions._count',
expectedValue: 0,
@@ -725,7 +725,7 @@ describe('SCORM 1.2 CMI Tests', () => {
/**
* cmi.objectives.n.score Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: objective(),
fieldName: 'cmi.score._children',
expectedValue: scorm12_constants.score_children,

View File

@@ -10,10 +10,9 @@ import {
CMIInteractionsObjectivesObject,
CMIObjectivesObject,
} from '../../src/cmi/scorm2004_cmi';
import * as h from '../helpers';
import * as h from '../cmi_helpers';
import {expect} from 'chai';
import {scorm2004_values} from '../../src/constants/field_values';
import {valid_languages} from '../../src/constants/language_constants';
const read_only = scorm2004_error_codes.READ_ONLY_ELEMENT;
const write_only = scorm2004_error_codes.WRITE_ONLY_ELEMENT;
@@ -158,7 +157,7 @@ describe('SCORM 2004 CMI Tests', () => {
/**
* cmi.learner_preference Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.learner_preference._children',
expectedValue: scorm2004_constants.student_preference_children,
@@ -216,7 +215,7 @@ describe('SCORM 2004 CMI Tests', () => {
/**
* cmi.score Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.score._children',
expectedValue: scorm2004_constants.score_children,
@@ -474,7 +473,7 @@ describe('SCORM 2004 CMI Tests', () => {
/**
* cmi.learner_preference Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.learner_preference._children',
expectedValue: scorm2004_constants.student_preference_children,
@@ -532,7 +531,7 @@ describe('SCORM 2004 CMI Tests', () => {
/**
* cmi.score Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: cmi(),
fieldName: 'cmi.score._children',
expectedValue: scorm2004_constants.score_children,
@@ -912,7 +911,7 @@ describe('SCORM 2004 CMI Tests', () => {
/**
* cmi.objectives.n.score Properties
*/
h.checkInvalidSet({
h.checkReadOnly({
cmi: objective(),
fieldName: 'cmi.score._children',
expectedValue: scorm2004_constants.score_children,