mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 01:34:57 +01:00
c72dfb6ced
* replaces market fileinfo with provider file info * removed test for replaced getFileInfo method * updated toast messages - if uploaded file when no web3 wallet is connected - if file is not valid * used provider api to check file' * moved get fileinfo logic to provider.ts * cancel fileinfo req on unmount * reduced fileinfo method complexity * canceltoken passed to fileinfo issue
43 lines
906 B
TypeScript
43 lines
906 B
TypeScript
import axios, { AxiosResponse } from 'axios'
|
|
|
|
import {
|
|
toStringNoMS,
|
|
updateQueryStringParameter,
|
|
isDid
|
|
} from '../../../src/utils'
|
|
|
|
jest.mock('axios')
|
|
|
|
describe('updateQueryStringParameter()', () => {
|
|
it('transform a URI', () => {
|
|
const newUri = updateQueryStringParameter(
|
|
'/hello?param=hello',
|
|
'param',
|
|
'hello2'
|
|
)
|
|
expect(newUri).toContain('param=hello2')
|
|
})
|
|
})
|
|
|
|
describe('toStringNoMS()', () => {
|
|
it('returns a ISO string from a Date object without the milliseconds', () => {
|
|
expect(toStringNoMS(new Date(1583956486719))).toEqual(
|
|
'2020-03-11T19:54:46Z'
|
|
)
|
|
})
|
|
})
|
|
|
|
describe('isDid()', () => {
|
|
it('checks correct DID', () => {
|
|
expect(
|
|
isDid(
|
|
'did:op:bb6b9e960b2e40e3840ca5eafc8eb97af431b4d190b54e2f9926e1f792cdc54f'
|
|
)
|
|
).toBe(true)
|
|
})
|
|
|
|
it('errors when no DID', () => {
|
|
expect(isDid('hello')).toBe(false)
|
|
})
|
|
})
|