mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Fixed broken tests
Signed-off-by: Pablo F. Mescher <pfmescher@gmail.com>
This commit is contained in:
parent
550ec76a35
commit
dd599c9f17
@ -26,7 +26,7 @@ export interface SearchQuery {
|
||||
* Aquarius provides an off-chain database store for metadata about data assets.
|
||||
*/
|
||||
export class Aquarius {
|
||||
private fetch: WebServiceConnector
|
||||
public fetch: WebServiceConnector
|
||||
private logger: Logger
|
||||
private aquariusUri: string
|
||||
|
||||
|
@ -5,6 +5,7 @@ import { Aquarius, SearchQuery } from '../../src/aquarius/Aquarius'
|
||||
import { DDO } from '../../src/ddo/DDO'
|
||||
import DID from '../../src/ocean/DID'
|
||||
import config from '../config'
|
||||
import { Logger } from '../../src/utils'
|
||||
|
||||
use(spies)
|
||||
|
||||
@ -53,7 +54,7 @@ describe('Aquarius', () => {
|
||||
} as SearchQuery
|
||||
|
||||
it('should query metadata', async () => {
|
||||
spy.on(ocean.utils.fetch, 'post', () => reponsify(getResults([new DDO()])))
|
||||
spy.on(aquarius.fetch, 'post', () => reponsify(getResults([new DDO()])))
|
||||
|
||||
const result = await aquarius.queryMetadata(query)
|
||||
assert.typeOf(result.results, 'array')
|
||||
@ -64,7 +65,7 @@ describe('Aquarius', () => {
|
||||
})
|
||||
|
||||
it('should query metadata and return real ddo', async () => {
|
||||
spy.on(ocean.utils.fetch, 'post', () => reponsify(getResults([new DDO()])))
|
||||
spy.on(aquarius.fetch, 'post', () => reponsify(getResults([new DDO()])))
|
||||
|
||||
const result = await aquarius.queryMetadata(query)
|
||||
assert.typeOf(result.results, 'array')
|
||||
@ -87,7 +88,7 @@ describe('Aquarius', () => {
|
||||
} as SearchQuery
|
||||
|
||||
it('should query metadata by text', async () => {
|
||||
spy.on(ocean.utils.fetch, 'get', () => reponsify(getResults([new DDO()])))
|
||||
spy.on(aquarius.fetch, 'get', () => reponsify(getResults([new DDO()])))
|
||||
|
||||
const result = await aquarius.queryMetadataByText(query)
|
||||
assert.typeOf(result.results, 'array')
|
||||
@ -98,9 +99,9 @@ describe('Aquarius', () => {
|
||||
})
|
||||
|
||||
it('should query metadata by text with a new instance', async () => {
|
||||
spy.on(ocean.utils.fetch, 'get', () => reponsify(getResults([new DDO()])))
|
||||
const aquariusNew = new Aquarius(config.aquariusUri, new Logger())
|
||||
spy.on(aquariusNew.fetch, 'get', () => reponsify(getResults([new DDO()])))
|
||||
|
||||
const aquariusNew = new Aquarius(config.aquariusUri, ocean.utils, null)
|
||||
const result = await aquariusNew.queryMetadataByText(query)
|
||||
assert.typeOf(result.results, 'array')
|
||||
assert.lengthOf(result.results, 1)
|
||||
@ -110,7 +111,7 @@ describe('Aquarius', () => {
|
||||
})
|
||||
|
||||
it('should query metadata and return real ddo', async () => {
|
||||
spy.on(ocean.utils.fetch, 'get', () => reponsify(getResults([new DDO()])))
|
||||
spy.on(aquarius.fetch, 'get', () => reponsify(getResults([new DDO()])))
|
||||
|
||||
const result = await aquarius.queryMetadataByText(query)
|
||||
assert.typeOf(result.results, 'array')
|
||||
@ -126,7 +127,7 @@ describe('Aquarius', () => {
|
||||
id: did.getId()
|
||||
})
|
||||
|
||||
spy.on(ocean.utils.fetch, 'post', () => reponsify(ddo))
|
||||
spy.on(aquarius.fetch, 'post', () => reponsify(ddo))
|
||||
|
||||
const result: DDO = await aquarius.storeDDO(ddo)
|
||||
assert(result)
|
||||
@ -141,8 +142,8 @@ describe('Aquarius', () => {
|
||||
id: did.getId()
|
||||
})
|
||||
|
||||
spy.on(ocean.utils.fetch, 'post', () => reponsify(ddo))
|
||||
spy.on(ocean.utils.fetch, 'get', () => reponsify(ddo))
|
||||
spy.on(aquarius.fetch, 'post', () => reponsify(ddo))
|
||||
spy.on(aquarius.fetch, 'get', () => reponsify(ddo))
|
||||
|
||||
const storageResult: DDO = await aquarius.storeDDO(ddo)
|
||||
assert(storageResult)
|
||||
|
Loading…
Reference in New Issue
Block a user