aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support/jsonBuilders/jsonBuilder.ts
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/cypress/support/jsonBuilders/jsonBuilder.ts')
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/jsonBuilder.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/jsonBuilder.ts b/vid-webpack-master/cypress/support/jsonBuilders/jsonBuilder.ts
index 0bab4e1da..2583d46a1 100644
--- a/vid-webpack-master/cypress/support/jsonBuilders/jsonBuilder.ts
+++ b/vid-webpack-master/cypress/support/jsonBuilders/jsonBuilder.ts
@@ -1,6 +1,9 @@
export class JsonBuilder<T> implements IJsonBuilder<T>{
- currentValue: T;
+ currentValue?: T;
+ constructor(currentValue ?: T){
+ this.currentValue = currentValue;
+ }
public basicJson(json: JSON, url: string, status: number, delay: number, alias: string, changeResFunc?: Function) : void {
this.currentValue = <T>JSON.parse(JSON.stringify(json));
this.currentValue = changeResFunc ? changeResFunc(this.currentValue) : this.currentValue;
@@ -17,9 +20,9 @@ export class JsonBuilder<T> implements IJsonBuilder<T>{
response: JSON.stringify(this.currentValue)
}).as(alias);
}
- public basicMock(jsonPath: string, url: string) {
+ public basicMock(jsonPath: string, url: string ,changeResFunc?: Function) {
cy.readFile(jsonPath).then((res) => {
- this.basicJson(res, url, 200, 0, url,);
+ this.basicJson(res, url, 200, 0, url, changeResFunc);
})
}
}