diff --git a/challenges/03-front-end-libraries/react.json b/challenges/03-front-end-libraries/react.json index c254a3f852..fc6adf8d7a 100644 --- a/challenges/03-front-end-libraries/react.json +++ b/challenges/03-front-end-libraries/react.json @@ -3,6 +3,11 @@ "order": 5, "time": "5 hours", "helpRoom": "Help", + "required": [ + { + "src": "https://cdnjs.cloudflare.com/ajax/libs/react/16.1.1/umd/react.development.js" + } + ], "challenges": [ { "id": "587d7dbc367417b2b2512bb1", @@ -17,7 +22,7 @@ ], "files": { "indexjsx": { - "key": "indexjxs", + "key": "indexjsx", "ext": "jsx", "name": "index", "contents": [ @@ -28,11 +33,11 @@ } }, "tests": [ - "assert(Enzyme.shallow(jsx).type === 'h1', 'message: The constant JSX should return an h1 element.');", - "assert(Enzyme.shallow(jsx).children() === 'Hello JSX!', 'message: The h1 tag should include the text Hello JSX!');" + "assert(Enzyme.shallow(jsx).type() === 'h1', 'message: The constant JSX should return an h1 element.');", + "assert(Enzyme.shallow(jsx).contains( 'Hello JSX!'), 'message: The h1 tag should include the text Hello JSX!');" ], "type": "modern", - "isRequired": true, + "isRequired": false, "translations": {} } ] diff --git a/index.js b/index.js index e2de5da823..e1d7f79a07 100644 --- a/index.js +++ b/index.js @@ -23,6 +23,8 @@ var createChallenges = var Block = app.models.Block; var destroyBlocks = Observable.fromNodeCallback(Block.destroyAll, Block); var createBlocks = Observable.fromNodeCallback(Block.create, Block); +const arrToString = arr => + Array.isArray(arr) ? arr.join('\n') : _.toString(arr); Observable.combineLatest( destroyChallenges(), @@ -82,6 +84,17 @@ Observable.combineLatest( ) ); + if (challenge.files) { + challenge.files = _.reduce(challenge.files, (map, file) => { + map[file.key] = { + ...file, + head: arrToString(file.head), + contents: arrToString(file.contents), + tail: arrToString(file.tail) + }; + return map; + }, {}); + } challenge.fileName = fileName; challenge.helpRoom = helpRoom; challenge.order = order;