@pie-element/ebsr 14.0.1 → 14.1.1-next.2
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/author/defaults.d.ts +67 -0
- package/dist/author/defaults.d.ts.map +1 -0
- package/dist/author/defaults.js +161 -0
- package/dist/author/index.d.ts +35 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +78 -0
- package/dist/author/main.d.ts +23 -0
- package/dist/author/main.d.ts.map +1 -0
- package/dist/author/main.js +121 -0
- package/dist/controller/defaults.d.ts +16 -0
- package/dist/controller/defaults.d.ts.map +1 -0
- package/dist/controller/defaults.js +26 -0
- package/dist/controller/index.d.ts +43 -0
- package/dist/controller/index.d.ts.map +1 -0
- package/dist/controller/index.js +186 -0
- package/dist/controller/utils.d.ts +11 -0
- package/dist/controller/utils.d.ts.map +1 -0
- package/dist/controller/utils.js +8 -0
- package/dist/delivery/index.d.ts +27 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +132 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.iife.d.ts +9 -0
- package/dist/index.iife.d.ts.map +1 -0
- package/dist/index.iife.js +165 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/get.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +7 -0
- package/dist/print/index.d.ts +26 -0
- package/dist/print/index.d.ts.map +1 -0
- package/dist/print/index.js +107 -0
- package/package.json +59 -18
- package/{configure/src/defaults.js → src/author/defaults.ts} +10 -0
- package/{configure/src/index.js → src/author/index.ts} +16 -6
- package/{configure/src/main.jsx → src/author/main.tsx} +14 -4
- package/{controller/src/defaults.js → src/controller/defaults.ts} +10 -0
- package/{controller/src/index.js → src/controller/index.ts} +13 -3
- package/{controller/src/utils.js → src/controller/utils.ts} +10 -0
- package/src/{index.js → delivery/index.tsx} +78 -3
- package/src/index.iife.ts +16 -0
- package/src/index.ts +1 -0
- package/src/{print.js → print/index.tsx} +12 -2
- package/CHANGELOG.json +0 -1547
- package/CHANGELOG.md +0 -2259
- package/LICENSE.md +0 -5
- package/README.md +0 -62
- package/configure/CHANGELOG.json +0 -992
- package/configure/CHANGELOG.md +0 -2126
- package/configure/lib/defaults.js +0 -229
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -154
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -222
- package/configure/lib/main.js.map +0 -1
- package/configure/package.json +0 -23
- package/configure/src/__tests__/index.test.js +0 -492
- package/controller/CHANGELOG.json +0 -552
- package/controller/CHANGELOG.md +0 -1269
- package/controller/lib/defaults.js +0 -31
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -448
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -18
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -18
- package/controller/src/__tests__/index.test.js +0 -591
- package/controller/src/__tests__/utils.test.js +0 -48
- package/docs/config-schema.json +0 -5787
- package/docs/config-schema.json.md +0 -4278
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -52
- package/docs/demo/index.html +0 -2
- package/docs/demo/session.js +0 -14
- package/docs/pie-schema.json +0 -2911
- package/docs/pie-schema.json.md +0 -2142
- package/ebsr.png +0 -0
- package/lib/index.js +0 -146
- package/lib/index.js.map +0 -1
- package/lib/print.js +0 -186
- package/lib/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -5664
- package/module/demo.js +0 -77
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -115
- package/module/print.html +0 -18
- package/module/print.js +0 -1
- package/src/__tests__/index.test.js +0 -129
|
@@ -1,591 +0,0 @@
|
|
|
1
|
-
import { model, outcome, createCorrectResponseSession } from '../index';
|
|
2
|
-
import { isResponseCorrect } from '../utils';
|
|
3
|
-
|
|
4
|
-
const PART_A = 'partA';
|
|
5
|
-
const PART_B = 'partB';
|
|
6
|
-
|
|
7
|
-
jest.mock('../utils', () => ({
|
|
8
|
-
isResponseCorrect: jest.fn(),
|
|
9
|
-
}));
|
|
10
|
-
|
|
11
|
-
describe('controller', () => {
|
|
12
|
-
let result, question, session, env;
|
|
13
|
-
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
question = {
|
|
16
|
-
partA: {
|
|
17
|
-
choiceMode: 'checkbox',
|
|
18
|
-
feedbackEnabled: true,
|
|
19
|
-
choices: [
|
|
20
|
-
{
|
|
21
|
-
value: 'yellow',
|
|
22
|
-
label: 'Yellow',
|
|
23
|
-
correct: true,
|
|
24
|
-
feedback: {
|
|
25
|
-
type: 'custom',
|
|
26
|
-
value: 'foo',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
value: 'green',
|
|
31
|
-
label: 'Green',
|
|
32
|
-
feedback: {
|
|
33
|
-
type: 'default',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
choicePrefix: 'numbers',
|
|
38
|
-
prompt: `prompt ${PART_A}`,
|
|
39
|
-
promptEnabled: true,
|
|
40
|
-
lockChoiceOrder: true,
|
|
41
|
-
partialScoring: false,
|
|
42
|
-
},
|
|
43
|
-
partB: {
|
|
44
|
-
choiceMode: 'checkbox',
|
|
45
|
-
feedbackEnabled: true,
|
|
46
|
-
choices: [
|
|
47
|
-
{
|
|
48
|
-
value: 'orange',
|
|
49
|
-
label: 'Orange',
|
|
50
|
-
correct: true,
|
|
51
|
-
feedback: {
|
|
52
|
-
type: 'custom',
|
|
53
|
-
value: 'foo',
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
value: 'purple',
|
|
58
|
-
label: 'Purple',
|
|
59
|
-
feedback: {
|
|
60
|
-
type: 'default',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
value: 'c',
|
|
65
|
-
correct: true,
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
choicePrefix: 'numbers',
|
|
69
|
-
prompt: `prompt ${PART_B}`,
|
|
70
|
-
promptEnabled: true,
|
|
71
|
-
lockChoiceOrder: true,
|
|
72
|
-
partialScoring: false,
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
describe('outcome partialScoring test', () => {
|
|
78
|
-
const mkQuestion = (extra) => ({
|
|
79
|
-
partA: {
|
|
80
|
-
choiceMode: 'radio',
|
|
81
|
-
feedbackEnabled: true,
|
|
82
|
-
choices: [
|
|
83
|
-
{
|
|
84
|
-
value: 'yellow',
|
|
85
|
-
label: 'Yellow',
|
|
86
|
-
correct: true,
|
|
87
|
-
feedback: {
|
|
88
|
-
type: 'custom',
|
|
89
|
-
value: 'foo',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
value: 'blue',
|
|
94
|
-
label: 'Blue',
|
|
95
|
-
correct: true,
|
|
96
|
-
feedback: {
|
|
97
|
-
type: 'custom',
|
|
98
|
-
value: 'foo',
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
value: 'green',
|
|
103
|
-
label: 'Green',
|
|
104
|
-
feedback: {
|
|
105
|
-
type: 'default',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
choicePrefix: 'numbers',
|
|
110
|
-
prompt: `prompt ${PART_A}`,
|
|
111
|
-
promptEnabled: true,
|
|
112
|
-
lockChoiceOrder: true,
|
|
113
|
-
},
|
|
114
|
-
partB: {
|
|
115
|
-
choiceMode: 'radio',
|
|
116
|
-
feedbackEnabled: true,
|
|
117
|
-
choices: [
|
|
118
|
-
{
|
|
119
|
-
value: 'orange',
|
|
120
|
-
label: 'Orange',
|
|
121
|
-
correct: true,
|
|
122
|
-
feedback: {
|
|
123
|
-
type: 'custom',
|
|
124
|
-
value: 'foo',
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
value: 'red',
|
|
129
|
-
label: 'Red',
|
|
130
|
-
correct: true,
|
|
131
|
-
feedback: {
|
|
132
|
-
type: 'custom',
|
|
133
|
-
value: 'foo',
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
value: 'purple',
|
|
138
|
-
label: 'Purple',
|
|
139
|
-
feedback: {
|
|
140
|
-
type: 'default',
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
choicePrefix: 'numbers',
|
|
145
|
-
prompt: `prompt ${PART_B}`,
|
|
146
|
-
promptEnabled: true,
|
|
147
|
-
lockChoiceOrder: true,
|
|
148
|
-
},
|
|
149
|
-
partialScoring: false,
|
|
150
|
-
...extra,
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
const assertOutcome = (message, extra, value1, value2, env, expected, expectedMax) => {
|
|
154
|
-
it(message, async () => {
|
|
155
|
-
const question = mkQuestion(extra);
|
|
156
|
-
const result = await outcome(question, { value: { partA: { value: value1 }, partB: { value: value2 } } }, env);
|
|
157
|
-
expect(result.score).toEqual(expected);
|
|
158
|
-
expect(result.max).toEqual(expectedMax);
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
assertOutcome(
|
|
163
|
-
'element.partialScoring = true, partA correct, partB correct',
|
|
164
|
-
{ partialScoring: true },
|
|
165
|
-
['yellow', 'blue'],
|
|
166
|
-
['orange', 'red'],
|
|
167
|
-
{ mode: 'evaluate' },
|
|
168
|
-
2,
|
|
169
|
-
2,
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
assertOutcome(
|
|
173
|
-
'element.partialScoring = true, partA correct, partB partially correct',
|
|
174
|
-
{ partialScoring: true },
|
|
175
|
-
['yellow', 'blue'],
|
|
176
|
-
['orange'],
|
|
177
|
-
{ mode: 'evaluate' },
|
|
178
|
-
1,
|
|
179
|
-
2,
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
assertOutcome(
|
|
183
|
-
'element.partialScoring = true, partA correct, partB incorrect',
|
|
184
|
-
{ partialScoring: true },
|
|
185
|
-
['yellow', 'blue'],
|
|
186
|
-
[],
|
|
187
|
-
{ mode: 'evaluate' },
|
|
188
|
-
1,
|
|
189
|
-
2,
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
assertOutcome(
|
|
193
|
-
'element.partialScoring = true, partA incorrect, partB correct',
|
|
194
|
-
{ partialScoring: true },
|
|
195
|
-
[],
|
|
196
|
-
['orange', 'red'],
|
|
197
|
-
{ mode: 'evaluate' },
|
|
198
|
-
0,
|
|
199
|
-
2,
|
|
200
|
-
);
|
|
201
|
-
|
|
202
|
-
assertOutcome(
|
|
203
|
-
'element.partialScoring = true, partA partially correct, partB partially correct',
|
|
204
|
-
{ partialScoring: true },
|
|
205
|
-
['yellow'],
|
|
206
|
-
['orange'],
|
|
207
|
-
{ mode: 'evaluate' },
|
|
208
|
-
0,
|
|
209
|
-
2,
|
|
210
|
-
);
|
|
211
|
-
|
|
212
|
-
assertOutcome(
|
|
213
|
-
'element.partialScoring = true, partA incorrect, partB partially correct',
|
|
214
|
-
{ partialScoring: true },
|
|
215
|
-
['yellow'],
|
|
216
|
-
['orange'],
|
|
217
|
-
{ mode: 'evaluate' },
|
|
218
|
-
0,
|
|
219
|
-
2,
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
assertOutcome(
|
|
223
|
-
'element.partialScoring = true, partA incorrect, partB incorrect',
|
|
224
|
-
{ partialScoring: true },
|
|
225
|
-
['yellow'],
|
|
226
|
-
['orange'],
|
|
227
|
-
{ mode: 'evaluate' },
|
|
228
|
-
0,
|
|
229
|
-
2,
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
assertOutcome(
|
|
233
|
-
'element.partialScoring = false, partA correct, partB correct',
|
|
234
|
-
{ partialScoring: false },
|
|
235
|
-
['yellow', 'blue'],
|
|
236
|
-
['orange', 'red'],
|
|
237
|
-
{ mode: 'evaluate' },
|
|
238
|
-
1,
|
|
239
|
-
1,
|
|
240
|
-
);
|
|
241
|
-
|
|
242
|
-
assertOutcome(
|
|
243
|
-
'element.partialScoring = false, partA incorrect, partB correct',
|
|
244
|
-
{ partialScoring: false },
|
|
245
|
-
['yellow'],
|
|
246
|
-
['orange', 'red'],
|
|
247
|
-
{ mode: 'evaluate' },
|
|
248
|
-
0,
|
|
249
|
-
1,
|
|
250
|
-
);
|
|
251
|
-
|
|
252
|
-
assertOutcome(
|
|
253
|
-
'element.partialScoring = false, partA correct, partB incorrect',
|
|
254
|
-
{ partialScoring: false },
|
|
255
|
-
['yellow', 'blue'],
|
|
256
|
-
['orange'],
|
|
257
|
-
{ mode: 'evaluate' },
|
|
258
|
-
0,
|
|
259
|
-
1,
|
|
260
|
-
);
|
|
261
|
-
|
|
262
|
-
assertOutcome(
|
|
263
|
-
'element.partialScoring = false, partA incorrect, partB incorrect',
|
|
264
|
-
{ partialScoring: false },
|
|
265
|
-
[],
|
|
266
|
-
[],
|
|
267
|
-
{ mode: 'evaluate' },
|
|
268
|
-
0,
|
|
269
|
-
1,
|
|
270
|
-
);
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
describe('outcome', () => {
|
|
274
|
-
describe('dichotomous', () => {
|
|
275
|
-
const returnsScoreOf = (message, values1, values2, score) => {
|
|
276
|
-
it(`${message} => ${score}`, async () => {
|
|
277
|
-
const result = await outcome(
|
|
278
|
-
{ ...question, partialScoring: false },
|
|
279
|
-
{ value: { partA: { value: values1 }, partB: { value: values2 } } },
|
|
280
|
-
);
|
|
281
|
-
expect(result.score).toEqual(score);
|
|
282
|
-
expect(result.max).toEqual(1);
|
|
283
|
-
});
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
returnsScoreOf('both correct', ['yellow'], ['orange', 'c'], 1); // both correct
|
|
287
|
-
returnsScoreOf('both incorrect', ['green'], ['purple'], 0); // both wrong
|
|
288
|
-
returnsScoreOf('partA incorrect, partB correct', ['green'], ['orange', 'c'], 0); // first wrong, second correct
|
|
289
|
-
returnsScoreOf('partA correct, partB incorrect', ['yellow'], ['purple'], 0); // first correct, second wrong
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
describe('partial scoring', () => {
|
|
293
|
-
const returnsScoreOf = (message, values1, values2, score) => {
|
|
294
|
-
it(`${message} => ${score}`, async () => {
|
|
295
|
-
const result = await outcome(
|
|
296
|
-
{ ...question, partialScoring: true },
|
|
297
|
-
{ value: { partA: { value: values1 }, partB: { value: values2 } } },
|
|
298
|
-
);
|
|
299
|
-
expect(result.score).toBeCloseTo(score);
|
|
300
|
-
expect(result.max).toEqual(2);
|
|
301
|
-
});
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
returnsScoreOf('both correct', ['yellow'], ['orange', 'c'], 2);
|
|
305
|
-
returnsScoreOf('both incorrect', [], [], 0);
|
|
306
|
-
returnsScoreOf('partA correct, partB incorrect', ['yellow'], [], 1);
|
|
307
|
-
returnsScoreOf('partA correct, partB partially correct', ['yellow'], ['c'], 1);
|
|
308
|
-
returnsScoreOf('partA incorrect, partB correct', ['green'], ['orange', 'c'], 0);
|
|
309
|
-
returnsScoreOf('partA partially correct, partB correct', ['green', 'yellow'], ['orange', 'c'], 0);
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
const returnsScoreWhen = (session) => {
|
|
313
|
-
it(`returns empty: true if session is ${JSON.stringify(session)}`, async () => {
|
|
314
|
-
const result = await outcome(question, session);
|
|
315
|
-
expect(result).toEqual({ score: 0, scoreA: 0, scoreB: 0, empty: true, logTrace: ['Student did not answer the question.'] });
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
returnsScoreWhen(undefined);
|
|
320
|
-
returnsScoreWhen(null);
|
|
321
|
-
returnsScoreWhen({});
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
describe('model', () => {
|
|
325
|
-
const capitalize = (value) => value.charAt(0).toUpperCase() + value.slice(1);
|
|
326
|
-
|
|
327
|
-
describe('mode: gather', () => {
|
|
328
|
-
beforeEach(async () => {
|
|
329
|
-
session = {};
|
|
330
|
-
env = { mode: 'gather' };
|
|
331
|
-
result = await model(question, session, env);
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
it('returns disabled', () => {
|
|
335
|
-
expect(result.disabled).toEqual(false);
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
it('returns mode', () => {
|
|
339
|
-
expect(result.mode).toEqual('gather');
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
const returnsPrompt = (part) => {
|
|
343
|
-
it(`returns ${part} prompt`, () => {
|
|
344
|
-
expect(result[part].prompt).toEqual(`prompt ${part}`);
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
const returnsChoiceMode = (part) => {
|
|
349
|
-
it(`returns ${part} choiceMode`, () => {
|
|
350
|
-
expect(result[part].choiceMode).toEqual('checkbox');
|
|
351
|
-
});
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
const returnsKeyMode = (part) => {
|
|
355
|
-
it(`returns ${part} choicePrefix`, () => {
|
|
356
|
-
expect(result[part].choicePrefix).toEqual('numbers');
|
|
357
|
-
});
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
const returnsComplete = (part, min) => {
|
|
361
|
-
it(`returns ${part} complete`, () => {
|
|
362
|
-
expect(result[part].complete).toEqual({ min });
|
|
363
|
-
});
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
const doesNotReturnCorrect = (part) => {
|
|
367
|
-
it(`does not return ${part} responseCorrect`, () => {
|
|
368
|
-
expect(result[part].responseCorrect).toBe(undefined);
|
|
369
|
-
});
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
const returnsChoices = (part, value1, value2) => {
|
|
373
|
-
it(`returns ${part} choices`, () => {
|
|
374
|
-
expect(result[part].choices).toEqual(
|
|
375
|
-
expect.arrayContaining([
|
|
376
|
-
{ value: value1, label: capitalize(value1), rationale: null },
|
|
377
|
-
{ value: value2, label: capitalize(value2), rationale: null },
|
|
378
|
-
]),
|
|
379
|
-
);
|
|
380
|
-
});
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
returnsPrompt(PART_A);
|
|
384
|
-
returnsPrompt(PART_B);
|
|
385
|
-
|
|
386
|
-
returnsChoiceMode(PART_A);
|
|
387
|
-
returnsChoiceMode(PART_B);
|
|
388
|
-
|
|
389
|
-
returnsKeyMode(PART_A);
|
|
390
|
-
returnsKeyMode(PART_B);
|
|
391
|
-
|
|
392
|
-
returnsComplete(PART_A, 1);
|
|
393
|
-
returnsComplete(PART_B, 2);
|
|
394
|
-
|
|
395
|
-
returnsChoices(PART_A, 'yellow', 'green');
|
|
396
|
-
returnsChoices(PART_B, 'orange', 'purple');
|
|
397
|
-
|
|
398
|
-
doesNotReturnCorrect(PART_A);
|
|
399
|
-
doesNotReturnCorrect(PART_B);
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
describe('model - with updateSession', () => {
|
|
403
|
-
it('calls updateSession', async () => {
|
|
404
|
-
session = { id: '1', element: 'ebsr-element' };
|
|
405
|
-
env = { mode: 'gather' };
|
|
406
|
-
const updateSession = jest.fn().mockResolvedValue();
|
|
407
|
-
await model(
|
|
408
|
-
{
|
|
409
|
-
...question,
|
|
410
|
-
partA: {
|
|
411
|
-
...question.partA,
|
|
412
|
-
lockChoiceOrder: false,
|
|
413
|
-
},
|
|
414
|
-
partB: {
|
|
415
|
-
...question.partB,
|
|
416
|
-
lockChoiceOrder: false,
|
|
417
|
-
},
|
|
418
|
-
},
|
|
419
|
-
session,
|
|
420
|
-
env,
|
|
421
|
-
updateSession,
|
|
422
|
-
);
|
|
423
|
-
expect(updateSession).toHaveBeenCalledWith('1', 'ebsr-element', {
|
|
424
|
-
shuffledValues: {
|
|
425
|
-
partA: expect.arrayContaining(['yellow', 'green']),
|
|
426
|
-
partB: expect.arrayContaining(['orange', 'purple']),
|
|
427
|
-
},
|
|
428
|
-
});
|
|
429
|
-
});
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
describe('model - without valid updateSession', () => {
|
|
433
|
-
const assertModel = (updateSession) => {
|
|
434
|
-
it(`does not throw error if updateSession is ${updateSession}`, async () => {
|
|
435
|
-
session = {
|
|
436
|
-
id: '1',
|
|
437
|
-
element: 'ebsr-element',
|
|
438
|
-
shuffledValues: { partA: [], partB: [] },
|
|
439
|
-
};
|
|
440
|
-
env = { mode: 'gather' };
|
|
441
|
-
|
|
442
|
-
await model(
|
|
443
|
-
{
|
|
444
|
-
...question,
|
|
445
|
-
partA: {
|
|
446
|
-
...question.partA,
|
|
447
|
-
lockChoiceOrder: false,
|
|
448
|
-
},
|
|
449
|
-
partB: {
|
|
450
|
-
...question.partB,
|
|
451
|
-
lockChoiceOrder: false,
|
|
452
|
-
},
|
|
453
|
-
},
|
|
454
|
-
session,
|
|
455
|
-
env,
|
|
456
|
-
);
|
|
457
|
-
});
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
assertModel(undefined);
|
|
461
|
-
assertModel(null);
|
|
462
|
-
assertModel('text');
|
|
463
|
-
});
|
|
464
|
-
|
|
465
|
-
describe('mode: view', () => {
|
|
466
|
-
beforeEach(async () => {
|
|
467
|
-
session = {};
|
|
468
|
-
env = { mode: 'view' };
|
|
469
|
-
result = await model(question, session, env);
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
it('returns disabled', () => {
|
|
473
|
-
expect(result.disabled).toEqual(true);
|
|
474
|
-
});
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
describe('mode: evaluate', () => {
|
|
478
|
-
beforeEach(async () => {
|
|
479
|
-
session = {};
|
|
480
|
-
env = { mode: 'evaluate' };
|
|
481
|
-
isResponseCorrect.mockReturnValue(false);
|
|
482
|
-
result = await model(question, session, env);
|
|
483
|
-
return result;
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
const returnsChoicesWCorrect = (part, value1, value2) => {
|
|
487
|
-
it(`returns ${part} choices w/ correct`, () => {
|
|
488
|
-
expect(result[part].choices).toEqual(
|
|
489
|
-
expect.arrayContaining([
|
|
490
|
-
{
|
|
491
|
-
value: value1,
|
|
492
|
-
label: capitalize(value1),
|
|
493
|
-
correct: true,
|
|
494
|
-
feedback: 'foo',
|
|
495
|
-
rationale: null,
|
|
496
|
-
},
|
|
497
|
-
{
|
|
498
|
-
value: value2,
|
|
499
|
-
label: capitalize(value2),
|
|
500
|
-
correct: false,
|
|
501
|
-
feedback: 'Incorrect',
|
|
502
|
-
rationale: null,
|
|
503
|
-
},
|
|
504
|
-
]),
|
|
505
|
-
);
|
|
506
|
-
});
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
const returnsChoicesWCorrectFeedbackDisabled = (part, value1, value2) => {
|
|
510
|
-
// feedback enabled for partB and disabled for partA
|
|
511
|
-
it(`returns ${part} choices w/ correct even if feedbackEnabled is false`, async () => {
|
|
512
|
-
let res = await model(
|
|
513
|
-
{
|
|
514
|
-
...question,
|
|
515
|
-
partA: {
|
|
516
|
-
...question.partA,
|
|
517
|
-
feedbackEnabled: false,
|
|
518
|
-
},
|
|
519
|
-
partB: {
|
|
520
|
-
...question.partB,
|
|
521
|
-
feedbackEnabled: false,
|
|
522
|
-
},
|
|
523
|
-
},
|
|
524
|
-
session,
|
|
525
|
-
env,
|
|
526
|
-
);
|
|
527
|
-
|
|
528
|
-
expect(result[part].choices).toEqual(
|
|
529
|
-
expect.arrayContaining([
|
|
530
|
-
{
|
|
531
|
-
value: value1,
|
|
532
|
-
label: capitalize(value1),
|
|
533
|
-
correct: true,
|
|
534
|
-
feedback: 'foo',
|
|
535
|
-
rationale: null,
|
|
536
|
-
},
|
|
537
|
-
{
|
|
538
|
-
value: value2,
|
|
539
|
-
label: capitalize(value2),
|
|
540
|
-
correct: false,
|
|
541
|
-
feedback: 'Incorrect',
|
|
542
|
-
rationale: null,
|
|
543
|
-
},
|
|
544
|
-
]),
|
|
545
|
-
);
|
|
546
|
-
});
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
const returnsIsResponseCorrect = (part) => {
|
|
550
|
-
it(`returns ${part} is response correct`, () => {
|
|
551
|
-
expect(result[part].responseCorrect).toEqual(false);
|
|
552
|
-
});
|
|
553
|
-
};
|
|
554
|
-
|
|
555
|
-
// Second param will be correct (yellow for A; orange for B)
|
|
556
|
-
returnsChoicesWCorrect(PART_A, 'yellow', 'green');
|
|
557
|
-
returnsChoicesWCorrect(PART_B, 'orange', 'purple');
|
|
558
|
-
|
|
559
|
-
// Second param will be correct (yellow for A; orange for B)
|
|
560
|
-
returnsChoicesWCorrectFeedbackDisabled(PART_A, 'yellow', 'green');
|
|
561
|
-
returnsChoicesWCorrectFeedbackDisabled(PART_B, 'orange', 'purple');
|
|
562
|
-
|
|
563
|
-
returnsIsResponseCorrect(PART_A);
|
|
564
|
-
returnsIsResponseCorrect(PART_B);
|
|
565
|
-
});
|
|
566
|
-
|
|
567
|
-
describe('correct response', () => {
|
|
568
|
-
it('returns correct response if env is correct', async () => {
|
|
569
|
-
const sess = await createCorrectResponseSession(question, {
|
|
570
|
-
mode: 'gather',
|
|
571
|
-
role: 'instructor',
|
|
572
|
-
});
|
|
573
|
-
expect(sess).toEqual({
|
|
574
|
-
id: '1',
|
|
575
|
-
value: {
|
|
576
|
-
partA: { id: 'partA', value: ['yellow'] },
|
|
577
|
-
partB: { id: 'partB', value: ['orange', 'c'] },
|
|
578
|
-
},
|
|
579
|
-
});
|
|
580
|
-
});
|
|
581
|
-
|
|
582
|
-
it('returns null env is student', async () => {
|
|
583
|
-
const noResult = await createCorrectResponseSession(question, {
|
|
584
|
-
mode: 'gather',
|
|
585
|
-
role: 'student',
|
|
586
|
-
});
|
|
587
|
-
expect(noResult).toBeNull();
|
|
588
|
-
});
|
|
589
|
-
});
|
|
590
|
-
});
|
|
591
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { isResponseCorrect } from '../utils';
|
|
2
|
-
|
|
3
|
-
describe('isResponseCorrect', () => {
|
|
4
|
-
let question;
|
|
5
|
-
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
question = {
|
|
8
|
-
partA: {
|
|
9
|
-
choiceMode: 'radio',
|
|
10
|
-
feedbackEnabled: true,
|
|
11
|
-
choices: [
|
|
12
|
-
{
|
|
13
|
-
value: 'yellow',
|
|
14
|
-
label: 'Yellow',
|
|
15
|
-
correct: true,
|
|
16
|
-
feedback: {
|
|
17
|
-
type: 'custom',
|
|
18
|
-
value: 'foo',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
value: 'green',
|
|
23
|
-
label: 'Green',
|
|
24
|
-
feedback: {
|
|
25
|
-
type: 'default',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
choicePrefix: 'numbers',
|
|
30
|
-
prompt: `prompt partA`,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const returnsIsResponseCorrect = (session) => {
|
|
36
|
-
it(`response is not correct if session is ${JSON.stringify(session)}`, () => {
|
|
37
|
-
expect(isResponseCorrect(question.partA, 'partA', session)).toEqual(false);
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
returnsIsResponseCorrect(undefined);
|
|
42
|
-
returnsIsResponseCorrect(null);
|
|
43
|
-
returnsIsResponseCorrect({});
|
|
44
|
-
|
|
45
|
-
it('response is correct if session is defined', () => {
|
|
46
|
-
expect(isResponseCorrect(question.partA, 'partA', { value: { partA: { value: ['yellow'] } } })).toEqual(true);
|
|
47
|
-
});
|
|
48
|
-
});
|