graphql-query-test-mock
Advanced tools
Comparing version 0.9.5 to 0.9.6
# Changelog | ||
## 0.9.6 | ||
- Bug fix from accidental mutation. Mutability is fun, but hard! | ||
## 0.9.5 | ||
@@ -4,0 +7,0 @@ - Added `ignoreThesePropertiesInVariables: Array<string>` to the mock config, which basically is a more convenient way of |
@@ -16,2 +16,4 @@ "use strict"; | ||
var _utils = require("./utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -51,3 +53,3 @@ | ||
if (!shouldMatchOnVariables || ( // Bypass if we should not match on variables | ||
queryMockConfig.matchVariables ? queryMockConfig.matchVariables(variables) : (0, _deepEqual.default)(variables, queryMockConfig.variables))) { | ||
queryMockConfig.matchVariables ? queryMockConfig.matchVariables(variables) : (0, _deepEqual.default)((0, _utils.getVariables)(variables, queryMockConfig.ignoreThesePropertiesInVariables || []), (0, _utils.getVariables)(queryMockConfig.variables, queryMockConfig.ignoreThesePropertiesInVariables || [])))) { | ||
var serverResponseData = { | ||
@@ -54,0 +56,0 @@ data: queryMockConfig.data |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.getQueryMockID = getQueryMockID; | ||
exports.getVariables = getVariables; | ||
exports.createMockGraphQLRecord = createMockGraphQLRecord; | ||
@@ -17,7 +18,13 @@ | ||
function getQueryMockID(queryName, variables, ignoreThesePropertiesInVariables) { | ||
var processedVariables = variables || {}; | ||
var processedVariables = getVariables(variables, ignoreThesePropertiesInVariables); | ||
return "".concat(queryName, "__").concat(JSON.stringify(processedVariables)); | ||
} | ||
function getVariables(variables, ignoreThesePropertiesInVariables) { | ||
var vars = _objectSpread({}, variables); | ||
ignoreThesePropertiesInVariables.forEach(function (propName) { | ||
delete processedVariables[propName]; | ||
delete vars[propName]; | ||
}); | ||
return "".concat(queryName, "__").concat(JSON.stringify(processedVariables)); | ||
return vars; | ||
} | ||
@@ -24,0 +31,0 @@ |
{ | ||
"name": "graphql-query-test-mock", | ||
"version": "0.9.5", | ||
"version": "0.9.6", | ||
"author": "Gabriel Nordeborn", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
265993
367