@sap-cloud-sdk/test-util 2.0.0-beta.0 → 2.0.0-beta.1-20220107142008.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { Destination } from '@sap-cloud-sdk/connectivity';
1
+ import { Destination } from '@sap-cloud-sdk/connectivity/internal';
2
2
  import { GetTestDestinationOptions } from './test-destination-provider';
3
3
  /**
4
4
  * Add a destination with the given name from the `systems.json` and `credentials.json` files to the `destinations` environment variable.
@@ -1 +1 @@
1
- {"version":3,"file":"test-destination-mocker.d.ts","sourceRoot":"","sources":["../src/test-destination-mocker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,yBAAyB,EAE1B,MAAM,6BAA6B,CAAC;AAErC;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,yBAAyB,GAClC,IAAI,CAGN;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAgBjE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAMxD;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,CAAC,EAAE,yBAAyB,GAClC,IAAI,CAqBN;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAMhD"}
1
+ {"version":3,"file":"test-destination-mocker.d.ts","sourceRoot":"","sources":["../src/test-destination-mocker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAGZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEL,yBAAyB,EAE1B,MAAM,6BAA6B,CAAC;AAErC;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,yBAAyB,GAClC,IAAI,CAGN;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAgBjE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAMxD;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,CAAC,EAAE,yBAAyB,GAClC,IAAI,CAqBN;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAMhD"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.unmockAllTestDestinations = exports.mockAllTestDestinations = exports.unmockTestDestination = exports.setTestDestination = exports.mockTestDestination = void 0;
4
+ const internal_1 = require("@sap-cloud-sdk/connectivity/internal");
4
5
  const test_destination_provider_1 = require("./test-destination-provider");
5
6
  /**
6
7
  * Add a destination with the given name from the `systems.json` and `credentials.json` files to the `destinations` environment variable.
@@ -32,9 +33,9 @@ function setTestDestination(destination) {
32
33
  if (!destination.name) {
33
34
  throw Error('The destination name is undefined.');
34
35
  }
35
- validateNameAvailable(destination.name, existingNames);
36
+ (0, internal_1.validateNameAvailable)(destination.name, existingNames);
36
37
  destination.isTestDestination = true;
37
- setDestinationsInEnv([...currentDestinations, destination]);
38
+ (0, internal_1.setDestinationsInEnv)([...currentDestinations, destination]);
38
39
  }
39
40
  exports.setTestDestination = setTestDestination;
40
41
  /**
@@ -45,7 +46,7 @@ exports.setTestDestination = setTestDestination;
45
46
  function unmockTestDestination(name) {
46
47
  const currentDestinations = getDestinationsFromEnv();
47
48
  const cleanedDestinations = currentDestinations.filter(destination => !(destination.isTestDestination && destination.name === name));
48
- setDestinationsInEnv(cleanedDestinations);
49
+ (0, internal_1.setDestinationsInEnv)(cleanedDestinations);
49
50
  }
50
51
  exports.unmockTestDestination = unmockTestDestination;
51
52
  /**
@@ -67,10 +68,10 @@ function mockAllTestDestinations(options) {
67
68
  if (!dest.name) {
68
69
  throw Error("At least one of the provided destinations is missing a the 'name' property!");
69
70
  }
70
- validateNameAvailable(dest.name, existingNames);
71
+ (0, internal_1.validateNameAvailable)(dest.name, existingNames);
71
72
  currentDestinations.push(dest);
72
73
  });
73
- setDestinationsInEnv(currentDestinations);
74
+ (0, internal_1.setDestinationsInEnv)(currentDestinations);
74
75
  }
75
76
  exports.mockAllTestDestinations = mockAllTestDestinations;
76
77
  /**
@@ -81,17 +82,9 @@ exports.mockAllTestDestinations = mockAllTestDestinations;
81
82
  function unmockAllTestDestinations() {
82
83
  const currentDestinations = getDestinationsFromEnv();
83
84
  const cleanedDestinations = currentDestinations.filter(destination => !destination.isTestDestination);
84
- setDestinationsInEnv(cleanedDestinations);
85
+ (0, internal_1.setDestinationsInEnv)(cleanedDestinations);
85
86
  }
86
87
  exports.unmockAllTestDestinations = unmockAllTestDestinations;
87
- function validateNameAvailable(destinationName, existingNames) {
88
- if (existingNames.has(destinationName)) {
89
- throw new Error(`Parsing mocked destinations failed, destination with name "${destinationName}" already exists in the "destinations" environment variables.`);
90
- }
91
- }
92
- function setDestinationsInEnv(destinations) {
93
- process.env['destinations'] = JSON.stringify(destinations);
94
- }
95
88
  function getDestinationsFromEnv() {
96
89
  try {
97
90
  const envDestinations = process.env['destinations'] || '[]';
@@ -1 +1 @@
1
- {"version":3,"file":"test-destination-mocker.js","sourceRoot":"","sources":["../src/test-destination-mocker.ts"],"names":[],"mappings":";;;AACA,2EAIqC;AAErC;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,IAAY,EACZ,OAAmC;IAEnC,MAAM,iBAAiB,GAAG,IAAA,qDAAyB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnE,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AACxC,CAAC;AAND,kDAMC;AAED;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAAC,WAAwB;IACzD,MAAM,mBAAmB,GAAG,sBAAsB,EAAE,CA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CAAC;KACH;AACH,CAAC"}
1
+ {"version":3,"file":"test-destination-mocker.js","sourceRoot":"","sources":["../src/test-destination-mocker.ts"],"names":[],"mappings":";;;AAAA,mEAI8C;AAC9C,2EAIqC;AAErC;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,IAAY,EACZ,OAAmC;IAEnC,MAAM,iBAAiB,GAAG,IAAA,qDAAyB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnE,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AACxC,CAAC;AAND,kDAMC;AAED;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAAC,WAAwB;IACzD,MAAM,mBAAmB,GAAG,sBAAsB,EAAE,CAAC;IACrD,MAAM,aAAa,GAAG,IAAI,GAAG,CAC3B,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,MAAM,KAAK,CAAC,oCAAoC,CAAC,CAAC;SACnD;QACD,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC,CAAC,CACH,CAAC;IACF,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE;QACrB,MAAM,KAAK,CAAC,oCAAoC,CAAC,CAAC;KACnD;IACD,IAAA,gCAAqB,EAAC,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACvD,WAAW,CAAC,iBAAiB,GAAG,IAAI,CAAC;IACrC,IAAA,+BAAoB,EAAC,CAAC,GAAG,mBAAmB,EAAE,WAAW,CAAC,CAAC,CAAC;AAC9D,CAAC;AAhBD,gDAgBC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,IAAY;IAChD,MAAM,mBAAmB,GAAG,sBAAsB,EAAE,CAAC;IACrD,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,MAAM,CACpD,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,iBAAiB,IAAI,WAAW,CAAC,IAAI,KAAK,IAAI,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;QAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;KACpC;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,qDAAqD,KAAK,CAAC,OAAO,EAAE,CACrE,CAAC;KACH;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-cloud-sdk/test-util",
3
- "version": "2.0.0-beta.0+8f9b860",
3
+ "version": "2.0.0-beta.1-20220107142008.0+26b3f57f",
4
4
  "description": "SAP Cloud SDK for JavaScript test utilities",
5
5
  "homepage": "https://sap.github.io/cloud-sdk/docs/js/overview-cloud-sdk-for-javascript",
6
6
  "license": "Apache-2.0",
@@ -30,11 +30,11 @@
30
30
  "check:dependencies": "depcheck ."
31
31
  },
32
32
  "dependencies": {
33
- "@sap-cloud-sdk/connectivity": "^2.0.0-beta.0+8f9b860",
34
- "@sap-cloud-sdk/util": "^2.0.0-beta.0+8f9b860"
33
+ "@sap-cloud-sdk/connectivity": "^2.0.0-beta.1-20220107142008.0+26b3f57f",
34
+ "@sap-cloud-sdk/util": "^2.0.0-beta.1-20220107142008.0+26b3f57f"
35
35
  },
36
36
  "devDependencies": {
37
37
  "mock-fs": "^5.0.0"
38
38
  },
39
- "gitHead": "8f9b8608a1c6633c901c4862aced4cb569bd30ec"
39
+ "gitHead": "26b3f57f4756d3c81388e9e7c05f8b6b69cf2621"
40
40
  }