Merge pull request #16 from Bouncey/feat/backendTests

Add backend tests
This commit is contained in:
Stuart Taylor
2018-04-17 11:33:04 +01:00
committed by Mrugesh Mohapatra
parent 5f0068e9c8
commit fa68757553
8 changed files with 52 additions and 44 deletions

View File

@@ -16,6 +16,7 @@ import _ from 'lodash';
import {
types,
challengeMetaSelector,
challengeTestsSelector,
initConsole,
updateConsole,
@@ -23,13 +24,15 @@ import {
updateTests,
disableJSOnError
} from './';
import { buildFromFiles } from '../utils/build';
import { buildFromFiles, buildBackendChallenge } from '../utils/build';
import {
runTestsInTestFrame,
createTestFramer,
createMainFramer
} from '../utils/frame.js';
import { backend } from '../../../../utils/challengeTypes';
const executeDebounceTimeout = 750;
function updateMainEpic(actions, { getState }, { document }) {
@@ -90,14 +93,14 @@ function executeChallengeEpic(action$, { getState }, { document }) {
// .filter(() => !codeLockedSelector(getState()))
switchMap(() => {
const state = getState();
// const { challengeType } = challengeSelector(state);
// if (challengeType === backend) {
// return buildBackendChallenge(state)
// .do(frameTests)
// .ignoreElements()
// .startWith(initOutput('// running test'))
// .catch(createErrorObservable);
// }
const { challengeType } = challengeMetaSelector(state);
if (challengeType === backend) {
return buildBackendChallenge(state)
.do(frameTests)
.ignoreElements()
.startWith(initConsole('// running test'))
.catch(err => disableJSOnError(err));
}
return buildFromFiles(state, false)
.do(frameTests)
.ignoreElements()