Skip to content

Commit

Permalink
fix: delete useless code, a little bit enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiyuSun committed Jul 26, 2023
1 parent 4bd22d1 commit 7b06a4b
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions __tests__/wallet-post.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const {apiKey} = seed;

describe('Wallet: create(POST) wallets of an account', () => {
let bearerTokenA;
let bearerTokenB;

before(async () => {
await seed.clear();
Expand All @@ -32,20 +31,6 @@ describe('Wallet: create(POST) wallets of an account', () => {
bearerTokenA = res.body.token;
expect(bearerTokenA).to.match(/\S+/);
}

{
// Authorizes before each of the follow tests
const res = await request(server)
.post('/auth')
.set('treetracker-api-key', apiKey)
.send({
wallet: seed.walletB.name,
password: seed.walletB.password,
});
expect(res).to.have.property('statusCode', 200);
bearerTokenB = res.body.token;
expect(bearerTokenB).to.match(/\S+/);
}
});


Expand Down Expand Up @@ -77,7 +62,7 @@ describe('Wallet: create(POST) wallets of an account', () => {
.set('content-type', 'application/json')
.set('Authorization', `Bearer ${bearerTokenA}`);

expect(res.body.code).to.eq(422);
expect(res).property('statusCode').to.eq(422);

const resB = await request(server)
.post('/wallets')
Expand All @@ -86,7 +71,7 @@ describe('Wallet: create(POST) wallets of an account', () => {
.set('content-type', 'application/json')
.set('Authorization', `Bearer ${bearerTokenA}`);

expect(resB.body.code).to.eq(422);
expect(resB).property('statusCode').to.eq(422);
})

it('create wallet with invalid characters', async () => {
Expand All @@ -100,7 +85,7 @@ describe('Wallet: create(POST) wallets of an account', () => {
.set('treetracker-api-key', apiKey)
.set('content-type', 'application/json')
.set('Authorization', `Bearer ${bearerTokenA}`);
expect(res.body.code).to.eq(422);
expect(res).property('statusCode').to.eq(422);
}
})
})

0 comments on commit 7b06a4b

Please sign in to comment.