@coorpacademy/progression-engine
Version:
48 lines • 1.22 kB
JavaScript
import test from 'ava';
import { getConfig } from '../../config';
import { computeInitialStepForReview } from '..';
import allSlides from './fixtures/slides';
const config = getConfig({
ref: 'review',
version: '1'
});
const availableContent = [{
ref: 'skill_41BBqFKoS',
slides: allSlides,
rules: null
}];
test('should return successExitNode if availableContent is empty', t => {
t.deepEqual(computeInitialStepForReview(config), {
type: 'move',
payload: {
nextContent: {
type: 'success',
ref: 'successExitNode'
},
instructions: null
}
});
});
test('should throw error if there are no slides in availableContent', t => {
t.throws(() => computeInitialStepForReview(config, [{
ref: '1.A1',
slides: [],
rules: null
}]), {
message: 'no slide in availableContent'
});
});
test('should create an initial action from the availableContent', t => {
const action = computeInitialStepForReview(config, availableContent);
t.deepEqual(action, {
type: 'move',
payload: {
instructions: null,
nextContent: {
type: 'slide',
ref: '1.A1.1'
}
}
});
});
//# sourceMappingURL=compute-initial-step-for-review.js.map