1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00
ocean.js/test/integration/Provider.test.ts
Călina Cenan 34f8b4a9e0
[WIP] Adds checkURL function to use provider endpoint. (#540)
* Adds checkURL function to use provider endpoint.

* Change Provider version in Travis.

* Update checkURL function to return full result instead of boolean.

Co-authored-by: Calina Cenan <calina.tutunaru@algotech.solutions>
2021-01-13 14:42:02 +02:00

26 lines
861 B
TypeScript

import { Ocean } from '../../src/ocean/Ocean'
import config from './config'
import { assert } from 'chai'
describe('Provider tests', () => {
let ocean: Ocean
it('Initialize Ocean', async () => {
ocean = await Ocean.getInstance(config)
})
it('Alice tests invalid provider', async () => {
const valid = await ocean.provider.isValidProvider('http://example.net')
assert(valid === false)
})
it('Alice tests valid provider', async () => {
const valid = await ocean.provider.isValidProvider('http://127.0.0.1:8030')
assert(valid === true)
})
it('Check a valid URL', async () => {
const url = 'https://s3.amazonaws.com/testfiles.oceanprotocol.com/info.0.json'
const response = await ocean.provider.checkURL(url)
assert(response.contentLength === '1161')
assert(response.contentType === 'application/json')
})
})