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

Issue 19 #20

Merged
merged 3 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#19 - Fix tests
  • Loading branch information
callmekatootie committed Nov 7, 2019
commit 2954f901953213056e2a23ddc31abebb5812f614
14 changes: 7 additions & 7 deletions src/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const insertData = async () => {
challengeId: '30104644',
memberId: '123456',
handle: 'user1',
score: 100,
aggregateScore: 100,
testsPassed: 10,
totalTestCases: 10,
groupIds: ['100', '200']
Expand All @@ -23,7 +23,7 @@ const insertData = async () => {
challengeId: '30104644',
memberId: '123457',
handle: 'user2',
score: 90,
aggregateScore: 90,
testsPassed: 9,
totalTestCases: 10,
groupIds: ['100', '200']
Expand All @@ -34,7 +34,7 @@ const insertData = async () => {
challengeId: '30104644',
memberId: '123458',
handle: 'user3',
score: 80,
aggregateScore: 80,
testsPassed: 8,
totalTestCases: 10,
groupIds: ['100', '200']
Expand All @@ -45,7 +45,7 @@ const insertData = async () => {
challengeId: '30104645',
memberId: '123456',
handle: 'user1',
score: 40,
aggregateScore: 40,
testsPassed: 8,
totalTestCases: 20,
groupIds: ['100', '200']
Expand All @@ -56,7 +56,7 @@ const insertData = async () => {
challengeId: '30104645',
memberId: '123457',
handle: 'user2',
score: 50,
aggregateScore: 50,
testsPassed: 10,
totalTestCases: 20,
groupIds: ['100', '200']
Expand All @@ -67,7 +67,7 @@ const insertData = async () => {
challengeId: '30104646',
memberId: '123456',
handle: 'user1',
score: 190,
aggregateScore: 190,
testsPassed: 4,
totalTestCases: 6,
groupIds: ['100']
Expand All @@ -78,7 +78,7 @@ const insertData = async () => {
challengeId: '30104646',
memberId: '123458',
handle: 'user3',
score: 200,
aggregateScore: 200,
testsPassed: 5,
totalTestCases: 6,
groupIds: ['100']
Expand Down
8 changes: 4 additions & 4 deletions test/common/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ prepare(function (done) {
.persist()
.post('/oauth/token')
.reply(200, { access_token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJUb3Bjb2RlciBVc2VyIiwiQ29ubmVjdCBTdXBwb3J0IiwiYWRtaW5pc3RyYXRvciIsInRlc3RSb2xlIiwiYWFhIiwidG9ueV90ZXN0XzEiLCJDb25uZWN0IE1hbmFnZXIiLCJDb25uZWN0IEFkbWluIiwiY29waWxvdCIsIkNvbm5lY3QgQ29waWxvdCBNYW5hZ2VyIl0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLWRldi5jb20iLCJoYW5kbGUiOiJUb255SiIsImV4cCI6MTU2NTY4MTkyMCwidXNlcklkIjoiODU0Nzg5OSIsImlhdCI6MTU1NTY4MTMyMCwiZW1haWwiOiJhamVmdHNAdG9wY29kZXIuY29tIiwianRpIjoiMTlhMDkzNzAtMjk4OC00N2I4LTkxODktMGRhODVjNjM0ZWQyIn0.V8nsQpbzQ_4iEd0dAbuYsfeydnhSAEQ95AKKwl8RONw' })
.get('/v3/challenges?filter=id=30000001')
.get('/v4/challenges?filter=id=30000001')
.reply(200, challengeAPIResponse[0])
.get('/v3/challenges?filter=id=30051825')
.get('/v4/challenges?filter=id=30051825')
.reply(200, challengeAPIResponse[1])
.get('/v3/challenges?filter=id=30051826')
.get('/v4/challenges?filter=id=30051826')
.reply(200, challengeAPIResponse[2])
.get('/v3/challenges?filter=id=31000000')
.get('/v4/challenges?filter=id=31000000')
.reply(200, challengeAPIResponse[3])
.get('/v3/users?filter=id=10000')
.reply(200, memberAPIResponse[0])
Expand Down
15 changes: 5 additions & 10 deletions test/e2e/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,10 @@ describe('Topcoder - Leaderboard API E2E Tests', () => {
id: '161d3655-9c80-4f90-8051-e209e8c21702',
submissionId: '261d3655-9c80-4f90-8051-e209e8c21702',
metadata: {
assertions: {
tests: {
pending: 0,
failed: 1,
total: 10
},
tests: {
total: 10
}
},
score: 90
Expand Down Expand Up @@ -360,7 +357,7 @@ describe('Topcoder - Leaderboard API E2E Tests', () => {
score: 50
})
expect(res.status).to.equal(204)
expect(debugLogs[3]).to.equal('Group ID of Challenge # 31000000 is not configured for processing!')
expect(debugLogs[3]).to.equal('Group ID ([30000]) of Challenge # 31000000 is not in the configured set of Ids (202343,20000000) configured for processing!')
})
})

Expand All @@ -371,13 +368,10 @@ describe('Topcoder - Leaderboard API E2E Tests', () => {
.send({
id: '361d3655-9c80-4f90-8051-e209e8c21701',
metadata: {
assertions: {
tests: {
pending: 0,
failed: 1,
total: 5
},
tests: {
total: 5
}
},
score: 80
Expand All @@ -393,7 +387,8 @@ describe('Topcoder - Leaderboard API E2E Tests', () => {
handle: 'TonyJ',
aggregateScore: 80,
testsPassed: 4,
totalTestCases: 5
totalTestCases: 5,
scoreLevel: 'up'
})
})

Expand Down
15 changes: 5 additions & 10 deletions test/unit/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,10 @@ describe('Topcoder - Leaderboard API Unit Tests', () => {
id: '161d3655-9c80-4f90-8051-e209e8c21702',
submissionId: '261d3655-9c80-4f90-8051-e209e8c21702',
metadata: {
assertions: {
tests: {
pending: 0,
failed: 1,
total: 10
},
tests: {
total: 10
}
},
score: 90
Expand Down Expand Up @@ -310,7 +307,7 @@ describe('Topcoder - Leaderboard API Unit Tests', () => {
submissionId: '261d3655-9c80-4f90-8051-e209e8c21707',
score: 50
})
expect(debugLogs[3]).to.equal('Group ID of Challenge # 31000000 is not configured for processing!')
expect(debugLogs[3]).to.equal('Group ID ([30000]) of Challenge # 31000000 is not in the configured set of Ids (202343,20000000) configured for processing!')
})
})

Expand All @@ -319,13 +316,10 @@ describe('Topcoder - Leaderboard API Unit Tests', () => {
const result = await service.updateLeaderboard('30051825', '8547899', {
id: '361d3655-9c80-4f90-8051-e209e8c21701',
metadata: {
assertions: {
tests: {
pending: 0,
failed: 1,
total: 5
},
tests: {
total: 5
}
},
score: 80
Expand All @@ -339,7 +333,8 @@ describe('Topcoder - Leaderboard API Unit Tests', () => {
handle: 'TonyJ',
aggregateScore: 80,
testsPassed: 4,
totalTestCases: 5
totalTestCases: 5,
scoreLevel: 'up'
})
})

Expand Down