Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 2954f90

Browse files
#19 - Fix tests
1 parent cad360d commit 2954f90

File tree

4 files changed

+21
-31
lines changed

4 files changed

+21
-31
lines changed

src/test-data.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const insertData = async () => {
1212
challengeId: '30104644',
1313
memberId: '123456',
1414
handle: 'user1',
15-
score: 100,
15+
aggregateScore: 100,
1616
testsPassed: 10,
1717
totalTestCases: 10,
1818
groupIds: ['100', '200']
@@ -23,7 +23,7 @@ const insertData = async () => {
2323
challengeId: '30104644',
2424
memberId: '123457',
2525
handle: 'user2',
26-
score: 90,
26+
aggregateScore: 90,
2727
testsPassed: 9,
2828
totalTestCases: 10,
2929
groupIds: ['100', '200']
@@ -34,7 +34,7 @@ const insertData = async () => {
3434
challengeId: '30104644',
3535
memberId: '123458',
3636
handle: 'user3',
37-
score: 80,
37+
aggregateScore: 80,
3838
testsPassed: 8,
3939
totalTestCases: 10,
4040
groupIds: ['100', '200']
@@ -45,7 +45,7 @@ const insertData = async () => {
4545
challengeId: '30104645',
4646
memberId: '123456',
4747
handle: 'user1',
48-
score: 40,
48+
aggregateScore: 40,
4949
testsPassed: 8,
5050
totalTestCases: 20,
5151
groupIds: ['100', '200']
@@ -56,7 +56,7 @@ const insertData = async () => {
5656
challengeId: '30104645',
5757
memberId: '123457',
5858
handle: 'user2',
59-
score: 50,
59+
aggregateScore: 50,
6060
testsPassed: 10,
6161
totalTestCases: 20,
6262
groupIds: ['100', '200']
@@ -67,7 +67,7 @@ const insertData = async () => {
6767
challengeId: '30104646',
6868
memberId: '123456',
6969
handle: 'user1',
70-
score: 190,
70+
aggregateScore: 190,
7171
testsPassed: 4,
7272
totalTestCases: 6,
7373
groupIds: ['100']
@@ -78,7 +78,7 @@ const insertData = async () => {
7878
challengeId: '30104646',
7979
memberId: '123458',
8080
handle: 'user3',
81-
score: 200,
81+
aggregateScore: 200,
8282
testsPassed: 5,
8383
totalTestCases: 6,
8484
groupIds: ['100']

test/common/prepare.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ prepare(function (done) {
1111
.persist()
1212
.post('/oauth/token')
1313
.reply(200, { access_token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJUb3Bjb2RlciBVc2VyIiwiQ29ubmVjdCBTdXBwb3J0IiwiYWRtaW5pc3RyYXRvciIsInRlc3RSb2xlIiwiYWFhIiwidG9ueV90ZXN0XzEiLCJDb25uZWN0IE1hbmFnZXIiLCJDb25uZWN0IEFkbWluIiwiY29waWxvdCIsIkNvbm5lY3QgQ29waWxvdCBNYW5hZ2VyIl0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLWRldi5jb20iLCJoYW5kbGUiOiJUb255SiIsImV4cCI6MTU2NTY4MTkyMCwidXNlcklkIjoiODU0Nzg5OSIsImlhdCI6MTU1NTY4MTMyMCwiZW1haWwiOiJhamVmdHNAdG9wY29kZXIuY29tIiwianRpIjoiMTlhMDkzNzAtMjk4OC00N2I4LTkxODktMGRhODVjNjM0ZWQyIn0.V8nsQpbzQ_4iEd0dAbuYsfeydnhSAEQ95AKKwl8RONw' })
14-
.get('/v3/challenges?filter=id=30000001')
14+
.get('/v4/challenges?filter=id=30000001')
1515
.reply(200, challengeAPIResponse[0])
16-
.get('/v3/challenges?filter=id=30051825')
16+
.get('/v4/challenges?filter=id=30051825')
1717
.reply(200, challengeAPIResponse[1])
18-
.get('/v3/challenges?filter=id=30051826')
18+
.get('/v4/challenges?filter=id=30051826')
1919
.reply(200, challengeAPIResponse[2])
20-
.get('/v3/challenges?filter=id=31000000')
20+
.get('/v4/challenges?filter=id=31000000')
2121
.reply(200, challengeAPIResponse[3])
2222
.get('/v3/users?filter=id=10000')
2323
.reply(200, memberAPIResponse[0])

test/e2e/test.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,10 @@ describe('Topcoder - Leaderboard API E2E Tests', () => {
197197
id: '161d3655-9c80-4f90-8051-e209e8c21702',
198198
submissionId: '261d3655-9c80-4f90-8051-e209e8c21702',
199199
metadata: {
200-
assertions: {
200+
tests: {
201201
pending: 0,
202202
failed: 1,
203203
total: 10
204-
},
205-
tests: {
206-
total: 10
207204
}
208205
},
209206
score: 90
@@ -360,7 +357,7 @@ describe('Topcoder - Leaderboard API E2E Tests', () => {
360357
score: 50
361358
})
362359
expect(res.status).to.equal(204)
363-
expect(debugLogs[3]).to.equal('Group ID of Challenge # 31000000 is not configured for processing!')
360+
expect(debugLogs[3]).to.equal('Group ID ([30000]) of Challenge # 31000000 is not in the configured set of Ids (202343,20000000) configured for processing!')
364361
})
365362
})
366363

@@ -371,13 +368,10 @@ describe('Topcoder - Leaderboard API E2E Tests', () => {
371368
.send({
372369
id: '361d3655-9c80-4f90-8051-e209e8c21701',
373370
metadata: {
374-
assertions: {
371+
tests: {
375372
pending: 0,
376373
failed: 1,
377374
total: 5
378-
},
379-
tests: {
380-
total: 5
381375
}
382376
},
383377
score: 80
@@ -393,7 +387,8 @@ describe('Topcoder - Leaderboard API E2E Tests', () => {
393387
handle: 'TonyJ',
394388
aggregateScore: 80,
395389
testsPassed: 4,
396-
totalTestCases: 5
390+
totalTestCases: 5,
391+
scoreLevel: 'up'
397392
})
398393
})
399394

test/unit/test.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,10 @@ describe('Topcoder - Leaderboard API Unit Tests', () => {
157157
id: '161d3655-9c80-4f90-8051-e209e8c21702',
158158
submissionId: '261d3655-9c80-4f90-8051-e209e8c21702',
159159
metadata: {
160-
assertions: {
160+
tests: {
161161
pending: 0,
162162
failed: 1,
163163
total: 10
164-
},
165-
tests: {
166-
total: 10
167164
}
168165
},
169166
score: 90
@@ -310,7 +307,7 @@ describe('Topcoder - Leaderboard API Unit Tests', () => {
310307
submissionId: '261d3655-9c80-4f90-8051-e209e8c21707',
311308
score: 50
312309
})
313-
expect(debugLogs[3]).to.equal('Group ID of Challenge # 31000000 is not configured for processing!')
310+
expect(debugLogs[3]).to.equal('Group ID ([30000]) of Challenge # 31000000 is not in the configured set of Ids (202343,20000000) configured for processing!')
314311
})
315312
})
316313

@@ -319,13 +316,10 @@ describe('Topcoder - Leaderboard API Unit Tests', () => {
319316
const result = await service.updateLeaderboard('30051825', '8547899', {
320317
id: '361d3655-9c80-4f90-8051-e209e8c21701',
321318
metadata: {
322-
assertions: {
319+
tests: {
323320
pending: 0,
324321
failed: 1,
325322
total: 5
326-
},
327-
tests: {
328-
total: 5
329323
}
330324
},
331325
score: 80
@@ -339,7 +333,8 @@ describe('Topcoder - Leaderboard API Unit Tests', () => {
339333
handle: 'TonyJ',
340334
aggregateScore: 80,
341335
testsPassed: 4,
342-
totalTestCases: 5
336+
totalTestCases: 5,
337+
scoreLevel: 'up'
343338
})
344339
})
345340

0 commit comments

Comments
 (0)