-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
1 changed file
with
46 additions
and
0 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,46 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-expressions */ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-nocheck test suite | ||
import chai from 'chai'; | ||
import tokenService from '../../src/services/tokenService'; | ||
import tokenApi from '../../src/apiServices/tokenApi'; | ||
import sinon from 'sinon'; | ||
import httpMocks from 'node-mocks-http'; | ||
|
||
const { expect, assert } = chai; | ||
|
||
describe('Token API', function () { | ||
describe('Token API: Correctly verifies asset data', function () { | ||
afterEach(function () { | ||
sinon.restore(); | ||
}); | ||
|
||
it('should return getTokenInfo successful result if value is valid', async function () { | ||
const request = httpMocks.createRequest({ | ||
method: 'GET', | ||
url: 'test', | ||
params: { | ||
network: "eth", | ||
address: "0x455e53cbb86018ac2b8092fdcd39d8444affc3f6" | ||
} | ||
}); | ||
await sinon | ||
.stub(tokenApi, 'getTokenInfo') | ||
.returns({ | ||
decimal: "18", | ||
logo: "http://eth.svg", | ||
name: "Ethereum", | ||
symbol: "eth" | ||
}); | ||
const response = httpMocks.createResponse({ | ||
eventEmiiter: require('events').EventEmitter, | ||
req: request, | ||
}); | ||
const res = await tokenApi.getTokenInfo(request, res); | ||
expect(res).to.have.property('decimal'); | ||
expect(res).to.have.property('logo'); | ||
expect(res).to.have.property('name'); | ||
expect(res).to.have.property('symbol'); | ||
}); | ||
}); | ||
}); |