New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-mock-record

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-mock-record - npm Package Compare versions

Comparing version 1.6.2 to 1.6.3

2

package.json
{
"name": "angular-mock-record",
"version": "1.6.2",
"version": "1.6.3",
"description": "An angular / protractor framework that mocks and records requests. Requests can be manually mocked or recorded like VCR.",

@@ -5,0 +5,0 @@ "main": "server.js",

@@ -23,3 +23,3 @@ # angular-mock-record

"exclude_params": [],
"normalize_params": []
"normalize_params": []
}

@@ -48,3 +48,3 @@ ```

`
`
it('should have the mocked request data', () => {

@@ -90,1 +90,6 @@ expect(page.getFoo().getText()).toContain('bar');

- Finally, set up your application's E2E endpoint configuration to point to `http://localhost:<port>/<api_path>`. Start the server, then run `ng e2e`. All requests will be recorded unless they are otherwise mocked.
# Publishing to NPM
- bump the version number in package.json
- run `npm publish` locally

@@ -11,4 +11,4 @@ const Utilities = require('./utilities.js');

findRecording(req, label) {
let recording = this.recordingExists(req.path, req.url, label);
findRecording(req, label, defaultDomain) {
let recording = this.recordingExists(req.path, req.url, label, defaultDomain);

@@ -22,10 +22,8 @@ if (recording) {

recordingExists(requestPath, requestUrl, label) {
recordingExists(requestPath, requestUrl, label, defaultDomain) {
let out = null;
let tape = this.tapeExists(requestPath, label);
if (tape) {
let recording = this.isRecordingOnTape(requestUrl, tape);
let recordingWithDomain = recording ? recording.find(rec => !!(rec.domain === this.config.domain && !rec.context)) : null;
let recordingWithContext = recording ? recording.find(rec => !!(rec.context === this.config.context && rec.domain === this.config.domain)) : null;
let shouldCheckContext = this.config.context;

@@ -35,18 +33,19 @@

// If no context or domain, use the first
if (!recordingWithDomain && !shouldCheckContext) {
// when no context & default domain
if (!shouldCheckContext && this.config.domain === defaultDomain) {
// return the first recording if: it has no context AND domain is either empty or default
out = recording ? recording.find(rec => !!((!rec.domain || (rec.domain === defaultDomain)) && !rec.context)) : null;
}
// when no context and client specific domain
if (!shouldCheckContext && this.config.domain != defaultDomain) {
// return the first recording if: it has no context AND matches requested domain
out = recording ? recording.find(rec => !!(rec.domain === this.config.domain && !rec.context)) : null;
out = recording[0];
// If no context and domain, use the domain recording
} else if (!shouldCheckContext && recordingWithDomain && !recordingWithDomain.context) {
out = recordingWithDomain;
}
// Lastly record a context-specific recording if context enabled
if (shouldCheckContext && recordingWithContext) {
out = recordingWithContext;
// when context enabled
if (shouldCheckContext) {
// return the first recording if: the domain matches requested domain AND context matches requested context
out = recording ? recording.find(rec => !!(rec.domain === this.config.domain && rec.context === this.config.context)) : null;

@@ -56,4 +55,5 @@ }

}
}
}
return out;

@@ -60,0 +60,0 @@ }

@@ -64,3 +64,3 @@ const Http = require('./http.js');

this.checkTapesForRecording(res, req, this.config.tape_name);
this.checkTapesForRecording(res, req, this.config.tape_name, this.defaultDomain);

@@ -70,4 +70,4 @@ }

checkTapesForRecording(res, req, tapeToCheck) {
let recording = this.recorder.findRecording(req, tapeToCheck);
checkTapesForRecording(res, req, tapeToCheck, defaultDomain) {
let recording = this.recorder.findRecording(req, tapeToCheck, defaultDomain);

@@ -74,0 +74,0 @@ if (recording) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc