feat(api): get challenges directly from /curriculum

This commit is contained in:
Oliver Eyton-Williams
2020-06-23 10:01:21 +02:00
parent 2aee480c46
commit 2da8eb23e9
5 changed files with 152 additions and 111 deletions

View File

@@ -16,7 +16,10 @@ export const mockFirstChallenge = {
id: '456def',
block: 'first',
superBlock: 'the',
dashedName: 'challenge'
dashedName: 'challenge',
challengeOrder: 0,
superOrder: 1,
order: 0
};
export const mockCompletedChallenge = {
@@ -117,16 +120,6 @@ export function createNewUserFromEmail(email) {
export const mockApp = {
models: {
Challenge: {
find() {
return firstChallengeUrl;
},
findById(id, cb) {
return id === mockChallenge.id
? cb(null, mockChallenge)
: cb(new Error('challenge not found'));
}
},
Donation: {
findOne(query, cb) {
return isEqual(query, matchSubscriptionIdQuery)
@@ -157,6 +150,8 @@ export const mockApp = {
}
};
export const mockAllChallenges = [mockFirstChallenge, mockChallenge];
export const mockGetFirstChallenge = () => firstChallengeUrl;
export const matchEmailQuery = {