2019-06-20 00:20:09 +02:00
|
|
|
import WebServiceConnector from '../../src/utils/WebServiceConnector'
|
2018-10-26 11:57:26 +02:00
|
|
|
|
2018-11-01 12:47:48 +01:00
|
|
|
// @ts-ignore
|
2018-11-19 12:16:11 +01:00
|
|
|
export default class WebServiceConnectorMock extends WebServiceConnector {
|
2018-11-01 12:47:48 +01:00
|
|
|
constructor(private returnData: any) {
|
|
|
|
super()
|
|
|
|
}
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
private async fetch(url, opts): Promise<any> {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
resolve({
|
|
|
|
ok: true,
|
|
|
|
json: () => {
|
2018-11-12 12:09:42 +01:00
|
|
|
return this.returnData ? this.returnData : {}
|
2018-11-01 12:47:48 +01:00
|
|
|
},
|
2018-11-01 13:24:41 +01:00
|
|
|
text: () => {
|
2019-09-09 12:18:54 +02:00
|
|
|
return this.returnData ? JSON.stringify(this.returnData.toString()) : ''
|
2019-06-20 00:20:09 +02:00
|
|
|
}
|
2018-11-01 12:47:48 +01:00
|
|
|
})
|
|
|
|
})
|
2018-10-26 11:57:26 +02:00
|
|
|
}
|
|
|
|
}
|