MCPcopy Create free account
hub / github.com/codecombat/codecombat / verifyLevel

Function verifyLevel

app/lib/level-generation.js:1714–1733  ·  view source on GitHub ↗
({ sourceLevel, thangs, solutionCode, starterCode, supermodel })

Source from the content-addressed store, hash-verified

1712}
1713
1714async function verifyLevel ({ sourceLevel, thangs, solutionCode, starterCode, supermodel }) {
1715 // console.log('Should verify', { sourceLevel, thangs, solutionCode, starterCode })
1716 const solutions = constructSolutions({ solutionCode, starterCode })
1717 const testContext = { running: 0, problems: 0, failed: 0, passedExceptFrames: 0, passed: 0, waiting: solutions.length, completed: 0, total: solutions.length }
1718
1719 return new Promise((resolve) => {
1720 const onVerifierTestUpdate = createVerifierTestListener(testContext, () => {
1721 if (testContext.completed === solutions.length || testContext.aborted) {
1722 resolve(testContext.passed + testContext.passedExceptFrames === solutions.length)
1723 }
1724 })
1725
1726 solutions.map(solution => {
1727 const childSupermodel = new SuperModel()
1728 childSupermodel.models = _.clone(supermodel.models)
1729 childSupermodel.collections = _.clone(supermodel.collections)
1730 return new VerifierTest(sourceLevel.get('slug'), onVerifierTestUpdate, childSupermodel, 'javascript', { devMode: false, solution, thangsOverride: thangs })
1731 })
1732 })
1733}
1734
1735function constructSolutions ({ solutionCode, starterCode }) {
1736 const solutions = []

Callers 1

Calls 4

constructSolutionsFunction · 0.85
cloneMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected