How to use the testcafe-hammerhead.ResponseMock function in testcafe-hammerhead

To help you get started, we’ve selected a few testcafe-hammerhead examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DevExpress / testcafe / src / api / request-hooks / request-mock.js View on Github external
respond (body, statusCode, headers) {
        if (!this.pendingRequestFilterRuleInit)
            throw new APIError('respond', RUNTIME_ERRORS.requestHookConfigureAPIError, RequestMock.name, "The 'onRequestTo' method was not called before 'respond'. You must call the 'onRequestTo' method to provide the URL requests to which are mocked.");

        const mock = new ResponseMock(body, statusCode, headers);
        const rule = new RequestFilterRule(this.pendingRequestFilterRuleInit);

        this.requestFilterRules.push(rule);
        this.mocks.set(rule, mock);
        this.pendingRequestFilterRuleInit = null;

        return this;
    }
}

testcafe-hammerhead

A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).

MIT
Latest version published 2 months ago

Package Health Score

83 / 100
Full package analysis

Similar packages