2018-10-26 11:57:26 +02:00
|
|
|
import AquariusConnector from "../../src/aquarius/AquariusConnector"
|
|
|
|
|
2018-11-01 12:47:48 +01:00
|
|
|
// @ts-ignore
|
2018-10-26 11:57:26 +02:00
|
|
|
export default class AquariusConnectorMock extends AquariusConnector {
|
|
|
|
|
2018-11-01 12:47:48 +01:00
|
|
|
constructor(private returnData: any) {
|
|
|
|
super()
|
|
|
|
}
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
private async fetch(url, opts): Promise<any> {
|
2018-10-26 11:57:26 +02:00
|
|
|
|
2018-11-01 12:47:48 +01:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
resolve({
|
|
|
|
ok: true,
|
|
|
|
json: () => {
|
|
|
|
return this.returnData ? this.returnData : []
|
|
|
|
},
|
2018-11-01 13:24:41 +01:00
|
|
|
text: () => {
|
|
|
|
return this.returnData ? this.returnData.toString() : ""
|
|
|
|
},
|
2018-11-01 12:47:48 +01:00
|
|
|
})
|
|
|
|
})
|
2018-10-26 11:57:26 +02:00
|
|
|
}
|
|
|
|
}
|