-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2e2123
commit 00dbf0c
Showing
137 changed files
with
3,373 additions
and
3,327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,13 @@ const { expect: chaiExpect } = chai | |
chai.use(chaiHttp) | ||
|
||
describe('AccountClaimToken endpoints', () => { | ||
|
||
describe('get by id', () => { | ||
test('when an unclaimed id is provided', async (done) => { | ||
chai.request(global.app) | ||
chai | ||
.request(global.app) | ||
.get(`${v1Path}/claim-account/6fc489b1-46b1-4f89-8734-e2f3725da3d8`) | ||
.end((err, res) => { | ||
chaiExpect(res).to.have.status(200); | ||
chaiExpect(res).to.have.status(200) | ||
|
||
chaiExpect(res.body.id).to.equal('6fc489b1-46b1-4f89-8734-e2f3725da3d8') | ||
chaiExpect(res.body.claimed).to.equal(false) | ||
|
@@ -23,10 +23,11 @@ describe('AccountClaimToken endpoints', () => { | |
}) | ||
|
||
test('when a claimed id is provided', async (done) => { | ||
chai.request(global.app) | ||
chai | ||
.request(global.app) | ||
.get(`${v1Path}/claim-account/faae1a5f-260a-40d7-89d5-fb1c48d75735`) | ||
.end((err, res) => { | ||
chaiExpect(res).to.have.status(400); | ||
chaiExpect(res).to.have.status(400) | ||
|
||
chaiExpect(res.body.message).to.equal('This token has already been claimed.') | ||
chaiExpect(Object.keys(res.body).length).to.equal(1) | ||
|
@@ -35,39 +36,40 @@ describe('AccountClaimToken endpoints', () => { | |
}) | ||
}) | ||
}) | ||
|
||
describe('redeem by id', () => { | ||
|
||
describe('redeem by id', () => { | ||
const sendBody1 = { | ||
"id": "6fc489b1-46b1-4f89-8734-e2f3725da3d8", | ||
"email": "[email protected]" | ||
id: '6fc489b1-46b1-4f89-8734-e2f3725da3d8', | ||
email: '[email protected]' | ||
} | ||
const sendBody2 = { | ||
"id": "faae1a5f-260a-40d7-89d5-fb1c48d75735", | ||
"email": "[email protected]" | ||
id: 'faae1a5f-260a-40d7-89d5-fb1c48d75735', | ||
email: '[email protected]' | ||
} | ||
const sendBody3 = { | ||
"id": "6fc489bz-46b1-4f89-8734-e2f3725da3d8", | ||
"email": "[email protected]" | ||
id: '6fc489bz-46b1-4f89-8734-e2f3725da3d8', | ||
email: '[email protected]' | ||
} | ||
|
||
test('valid redeem', async (done) => { | ||
chai.request(global.app) | ||
chai | ||
.request(global.app) | ||
.post(`${v1Path}/claim-account`) | ||
.send(sendBody1) | ||
.end((err, res) => { | ||
chaiExpect(res).to.have.status(200); | ||
chaiExpect(res).to.have.status(200) | ||
|
||
done() | ||
}) | ||
}) | ||
|
||
test('claimed redeem', async (done) => { | ||
chai.request(global.app) | ||
chai | ||
.request(global.app) | ||
.post(`${v1Path}/claim-account`) | ||
.send(sendBody2) | ||
.end((err, res) => { | ||
chaiExpect(res).to.have.status(400); | ||
chaiExpect(res).to.have.status(400) | ||
|
||
chaiExpect(res.body.message).to.equal('This offer has already been claimed.') | ||
chaiExpect(Object.keys(res.body).length).to.equal(1) | ||
|
@@ -77,19 +79,20 @@ describe('AccountClaimToken endpoints', () => { | |
}) | ||
|
||
test('invalid redeem', async (done) => { | ||
chai.request(global.app) | ||
chai | ||
.request(global.app) | ||
.post(`${v1Path}/claim-account`) | ||
.send(sendBody3) | ||
.end((err, res) => { | ||
chaiExpect(res).to.have.status(500); | ||
chaiExpect(res).to.have.status(500) | ||
|
||
chaiExpect(res.body.message).to.equal('invalid input syntax for type uuid: \"6fc489bz-46b1-4f89-8734-e2f3725da3d8\"') | ||
chaiExpect(res.body.message).to.equal( | ||
'invalid input syntax for type uuid: "6fc489bz-46b1-4f89-8734-e2f3725da3d8"' | ||
) | ||
chaiExpect(Object.keys(res.body).length).to.equal(1) | ||
|
||
done() | ||
}) | ||
}) | ||
|
||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 14 additions & 16 deletions
30
__tests__/integration/routes/v1/appStorePurchase.itest.ts
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.