1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00
market/tests/unit/utils/getAssetRating.test.ts

24 lines
564 B
TypeScript
Raw Normal View History

2020-05-07 08:03:30 +02:00
import axios, { AxiosResponse } from 'axios'
import getAssetRating, {
GetRatingResponse
} from '../../../src/utils/getAssetRating'
jest.mock('axios')
describe('getAssetRating()', () => {
it('success', async () => {
const ratingResponse: GetRatingResponse = {
comment: '',
datePublished: '',
vote: 5
}
2020-06-30 14:19:27 +02:00
;(axios.get as any).mockResolvedValueOnce({
2020-05-07 08:03:30 +02:00
data: [ratingResponse, ratingResponse]
} as AxiosResponse)
const response = await getAssetRating('0x00', '0x00')
expect(response && response.vote).toBe(5)
})
})