mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
26 lines
731 B
TypeScript
26 lines
731 B
TypeScript
import WebServiceConnector from '../../src/utils/WebServiceConnector'
|
|
|
|
// @ts-ignore
|
|
export default class WebServiceConnectorMock extends WebServiceConnector {
|
|
constructor(private returnData: any) {
|
|
super()
|
|
}
|
|
|
|
// @ts-ignore
|
|
private async fetch(url, opts): Promise<any> {
|
|
return new Promise((resolve, reject) => {
|
|
resolve({
|
|
ok: true,
|
|
json: () => {
|
|
return this.returnData ? this.returnData : {}
|
|
},
|
|
text: () => {
|
|
return this.returnData
|
|
? JSON.stringify(this.returnData.toString())
|
|
: ''
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|