| 1733 | } |
| 1734 | |
| 1735 | function constructSolutions ({ solutionCode, starterCode }) { |
| 1736 | const solutions = [] |
| 1737 | solutions.push({ source: solutionCode, language: 'javascript', succeeds: true }) |
| 1738 | solutions.push({ source: starterCode, language: 'javascript', succeeds: false }) |
| 1739 | const solutionCodeLines = solutionCode.split('\n') |
| 1740 | for (let i = 0; i < solutionCodeLines.length; ++i) { |
| 1741 | if (i !== solutionCodeLines.length - 1) { |
| 1742 | // Maybe we don't need to test all the intermediate lines, and just testing starter code plus solution less last line is enough |
| 1743 | continue |
| 1744 | } |
| 1745 | solutions.push({ source: solutionCodeLines.slice(0, i).join('\n'), language: 'javascript', succeeds: false }) |
| 1746 | } |
| 1747 | return solutions |
| 1748 | } |
| 1749 | |
| 1750 | function createVerifierTestListener (testContext, onAllTestsCompleted) { |
| 1751 | return (e) => { |