Fix challenge tests that rely on

This commit is contained in:
Bouncey
2018-09-11 15:06:49 +01:00
committed by Mrugesh Mohapatra
parent 980994ceac
commit e7211fc67b
2 changed files with 8 additions and 16 deletions

View File

@ -26,7 +26,6 @@ import {
initConsole, initConsole,
updateConsole, updateConsole,
initLogs, initLogs,
updateLogs,
logsToConsole, logsToConsole,
checkChallenge, checkChallenge,
updateTests, updateTests,
@ -51,10 +50,7 @@ function updateMainEpic(actions, { getState }, { document }) {
const proxyLogger = new Subject(); const proxyLogger = new Subject();
const frameMain = createMainFramer(document, getState, proxyLogger); const frameMain = createMainFramer(document, getState, proxyLogger);
const buildAndFrameMain = actions.pipe( const buildAndFrameMain = actions.pipe(
ofType( ofType(types.updateFile, types.challengeMounted),
types.updateFile,
types.challengeMounted
),
debounceTime(executeDebounceTimeout), debounceTime(executeDebounceTimeout),
switchMap(() => switchMap(() =>
buildFromFiles(getState(), true).pipe( buildFromFiles(getState(), true).pipe(
@ -75,12 +71,13 @@ function executeChallengeEpic(action$, { getState }, { document }) {
filter(Boolean), filter(Boolean),
switchMap(() => { switchMap(() => {
const frameReady = new Subject(); const frameReady = new Subject();
const proxyLogger = new Subject(); // Removed for investigation into freeCodeCamp/Learn#291
// const proxyLogger = new Subject();
const frameTests = createTestFramer( const frameTests = createTestFramer(
document, document,
getState, getState,
frameReady, frameReady
proxyLogger // proxyLogger
); );
const challengeResults = frameReady.pipe( const challengeResults = frameReady.pipe(
pluck('checkChallengePayload'), pluck('checkChallengePayload'),
@ -117,7 +114,7 @@ function executeChallengeEpic(action$, { getState }, { document }) {
const build = const build =
challengeType === backend challengeType === backend
? buildBackendChallenge(state) ? buildBackendChallenge(state)
: buildFromFiles(state, true); : buildFromFiles(state, false);
return build.pipe( return build.pipe(
tap(frameTests), tap(frameTests),
ignoreElements(), ignoreElements(),
@ -127,11 +124,7 @@ function executeChallengeEpic(action$, { getState }, { document }) {
); );
}) })
); );
return merge( return merge(buildAndFrameChallenge, challengeResults);
buildAndFrameChallenge,
challengeResults,
proxyLogger.map(updateLogs)
);
}) })
); );
} }

View File

@ -140,12 +140,11 @@ export const createMainFramer = (document, getState, proxyLogger) =>
writeContentToFrame writeContentToFrame
); );
export const createTestFramer = (document, getState, frameReady, proxyLogger) => export const createTestFramer = (document, getState, frameReady) =>
flow( flow(
createFrame(document, getState, testId), createFrame(document, getState, testId),
mountFrame(document), mountFrame(document),
addDepsToDocument, addDepsToDocument,
writeTestDepsToDocument(frameReady), writeTestDepsToDocument(frameReady),
buildProxyConsole(proxyLogger),
writeContentToFrame writeContentToFrame
); );