Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
angular-mock-record
Advanced tools
An angular / protractor framework that mocks and records requests. Requests can be manually mocked or recorded like VCR.
An Angular 4+ framework that mocks and records requests. Requests can be manually mocked or recorded like VCR.
npm install angular-mock-record
mock.record.config.json
file in the root of your Angular app:{
"domain": "http://your.api.domain",
"port": 3000,
"cors": false,
"tape_name": "vcr",
"proxied_mock_server_route": "/e2e",
"request_headers": [
"X-XSRF-TOKEN",
"cookie"
],
"recording_dir": "./e2e/mocks",
"allow_recording": false,
"exclude_params": [],
"normalize_params": []
}
import { MockUtilities } from 'angular-mock-record/client/mock.utilities';
beforeAll(() => { mockUtilities.mockRequest('path/yourRequest.json', {foo: 'bar'}); )};
it('should have the mocked request data', () => { expect(page.getFoo().getText()).toContain('bar'); });
afterAll(() => { mockUtilities.clearMocks(); });
domain
as the request path that will be used to make requests and record.exclude_params
. Ex: exclude_params: ['sort']
normalize_params
. Ex: normalize_params: ['randomly_generated_id']
allow_recording
to true to fail when a new recording is detected. This is handy for continuous integration tools such as Travis CI.To set the client to login as (If not specified, product demo a is the default):
mockUtilities.setClient( clientOverride.getClientDomain(<client>) );
To login and record authenticated requests, use:
mockUtilities.login(<user from idp auth>);
To set a "context" and limit new recordings to the scope of that context:
mockUtilities.setContext(<name of context>);
As usual, clear the mocks in the afterAll block at the end of the spec file. This will also reset context, client and login status:
mockUtilities.clearMocks();
node ./node_modules/angular-mock-record/server/server.js allow_recording
http://localhost:<port>/<api_path>
in a browser to test the recording functionality. Once recorded, requests matching this URL will return the captured recording.http://localhost:<port>/<api_path>
. Start the server, then run ng e2e
. All requests will be recorded unless they are otherwise mocked.npm publish
locallyFAQs
An angular / protractor framework that mocks and records requests. Requests can be manually mocked or recorded like VCR.
The npm package angular-mock-record receives a total of 1 weekly downloads. As such, angular-mock-record popularity was classified as not popular.
We found that angular-mock-record demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.