Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addStateToMockedRequest(mockedRequestId, { name, response }) {
this.findById(mockedRequestId).addState({ name, response });
PersistentStorage.persist();
}
addScenario(name) {
this.scenarios.push(new Scenario({name}));
PersistentStorage.persist();
}
setGroups(groups) {
this.all = groups.map((group) => new Group(group));
PersistentStorage.dataTree.groups = this.all;
PersistentStorage.persist();
}
}
selectStateInMockedRequest(mockedRequestId, stateId) {
this.findById(mockedRequestId).selectState(stateId);
PersistentStorage.persist();
}
mergeGroups(groups) {
for (const group of groups) {
const existingGroup = find(this.all, { id: group.id });
if (existingGroup) {
assign(existingGroup, group);
} else {
this.all.push(new Group(group));
}
}
PersistentStorage.persist();
}
updateMock(mockId, request) {
this.find({ id: mockId }).update(request);
PersistentStorage.persist();
}
toggle(id) {
const scenario = this.getById(id);
scenario.active = !scenario.active;
PersistentStorage.persist();
}
updateMockRequest(scenarioId, mockRequestId, request) {
this.getById(scenarioId).updateMockedRequest(mockRequestId, request);
PersistentStorage.persist();
}
addMockedRequest(capturedRequest) {
this.mockedRequests.push(
new MockedRequest(capturedRequest.buildMockedRequestData())
);
PersistentStorage.persist();
}
const done = (id) => {
PersistentStorage.persist();
cb(id);
};