MCPcopy Index your code
hub / github.com/codecombat/codecombat / getTestStudentId

Method getTestStudentId

app/models/User.js:1319–1334  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1317 }
1318
1319 getTestStudentId () {
1320 const testStudentRelation = (this.get('related') || []).filter(related => related.relation === 'TestStudent')[0]
1321 if (testStudentRelation) {
1322 return Promise.resolve({ id: testStudentRelation.userId, new: false })
1323 } else {
1324 return new Promise((resolve, reject) => {
1325 try {
1326 this.createTestStudentAccount().then(response => {
1327 resolve({ id: response.relatedUserId, new: true })
1328 })
1329 } catch (e) {
1330 reject(e)
1331 }
1332 })
1333 }
1334 }
1335
1336 switchToStudentMode () {
1337 return this.getTestStudentId().then(({ id }) => this.spy({ id }))

Callers 1

switchToStudentModeMethod · 0.95

Calls 3

getMethod · 0.95
filterMethod · 0.80

Tested by

no test coverage detected