2019-11-14 11:57:53 +01:00
|
|
|
import { assert, spy, use } from 'chai'
|
2019-11-14 19:42:36 +01:00
|
|
|
import spies from 'chai-spies'
|
2019-11-14 11:57:53 +01:00
|
|
|
|
2020-01-30 22:08:18 +01:00
|
|
|
import { SearchQuery } from '../../../src/aquarius/Aquarius'
|
|
|
|
import { Ocean } from '../../../src/ocean/Ocean'
|
2019-11-14 11:57:53 +01:00
|
|
|
import config from '../config'
|
|
|
|
|
|
|
|
use(spies)
|
|
|
|
|
|
|
|
let ocean: Ocean
|
|
|
|
|
|
|
|
describe('OceanAssets', () => {
|
|
|
|
before(async () => {
|
|
|
|
ocean = await Ocean.getInstance(config)
|
|
|
|
})
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
spy.restore()
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('#query()', () => {
|
|
|
|
it('should search for assets', async () => {
|
|
|
|
const query: SearchQuery = {
|
|
|
|
offset: 100,
|
|
|
|
page: 1,
|
|
|
|
query: {
|
|
|
|
text: 'Office'
|
|
|
|
},
|
|
|
|
sort: {
|
|
|
|
created: -1
|
|
|
|
}
|
|
|
|
} as SearchQuery
|
|
|
|
|
|
|
|
const assets = await ocean.assets.query(query)
|
|
|
|
|
|
|
|
assert(assets)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('#search()', () => {
|
|
|
|
it('should search for assets', async () => {
|
|
|
|
const text = 'office'
|
|
|
|
const assets = await ocean.assets.search(text)
|
|
|
|
|
|
|
|
assert(assets)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|