mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
search test tweaks
This commit is contained in:
parent
b31a661dcb
commit
6111c33a0c
@ -1,7 +1,6 @@
|
||||
import { assert, spy, use } from 'chai'
|
||||
import * as spies from 'chai-spies'
|
||||
|
||||
import { SearchQuery } from '../../src/aquarius/Aquarius'
|
||||
import Account from '../../src/ocean/Account'
|
||||
import { Ocean } from '../../src/ocean/Ocean'
|
||||
import config from '../config'
|
||||
@ -41,33 +40,4 @@ describe('Ocean', () => {
|
||||
assert(typeof accs[0].getId() === 'string')
|
||||
})
|
||||
})
|
||||
|
||||
describe('#searchAssets()', () => {
|
||||
it('should search for assets', async () => {
|
||||
const query = {
|
||||
offset: 100,
|
||||
page: 1,
|
||||
query: {
|
||||
value: 1
|
||||
},
|
||||
sort: {
|
||||
value: 1
|
||||
},
|
||||
text: 'Office'
|
||||
} as SearchQuery
|
||||
|
||||
const assets = await ocean.assets.query(query)
|
||||
|
||||
assert(assets)
|
||||
})
|
||||
})
|
||||
|
||||
describe('#searchAssetsByText()', () => {
|
||||
it('should search for assets', async () => {
|
||||
const text = 'office'
|
||||
const assets = await ocean.assets.search(text)
|
||||
|
||||
assert(assets)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
48
test/ocean/OceanAssets.test.ts
Normal file
48
test/ocean/OceanAssets.test.ts
Normal file
@ -0,0 +1,48 @@
|
||||
import { assert, spy, use } from 'chai'
|
||||
import * as spies from 'chai-spies'
|
||||
|
||||
import { SearchQuery } from '../../src/aquarius/Aquarius'
|
||||
import { Ocean } from '../../src/ocean/Ocean'
|
||||
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)
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user