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
Alex Coseru 16c21e1ecb
add updateServiceTimeout and edit ddo updates (#544)
* add updateServiceTimeout

* remove unnecessary code

* fix travis

* fix

* add fileinfo endpoint

* fix did problem

* namings refactor

* lint fix
2021-01-18 12:02:38 +02:00

31 lines
1.1 KiB
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.fileinfo(url)
assert(response[0].contentLength === '1161')
assert(response[0].contentType === 'application/json')
})
it('Check a invalid URL', async () => {
const url = 'https://s3.amazonaws.com/testfiles.oceanprotocol.com/nosuchfile'
const response = await ocean.provider.fileinfo(url)
assert(response[0].valid === false)
})
})