@ticketmaster/allure-mock
Advanced tools
Comparing version 4.0.9 to 4.0.10
@@ -26,2 +26,6 @@ /** | ||
export { identityMock } from "./modules/identity/identity.mock"; | ||
/** | ||
* featureFlag module | ||
*/ | ||
export { featureFlagMock } from "./modules/feature-flag/feature-flag.mock"; | ||
export { IDENTITY_JWT_SECRET, IDENTITY_LOGIN_URL, IDENTITY_PROFILE_URL, } from "./modules/identity/identity.constant"; | ||
@@ -28,0 +32,0 @@ export { IdentityJWT, ContextClass, } from "./modules/identity/identity.definition"; |
@@ -366,3 +366,3 @@ import { Response, createServer } from 'miragejs'; | ||
const configurationMock = (server) => { | ||
server.get(`/api/v1/configuration`, (schema, request) => { | ||
server.get(`/api/v1/globalconfiguration`, (schema, request) => { | ||
const session = getSessionFromRequest(request); | ||
@@ -592,2 +592,58 @@ const publicConfig = { | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function __rest(s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
} | ||
const data = { | ||
feature_flags: { | ||
home: true, | ||
private: true, | ||
form: false, | ||
dialog: false, | ||
internal: true, | ||
"private-2": false, | ||
users: true, | ||
classes: true, | ||
cashierGroups: true, | ||
posPermissions: true, | ||
}, | ||
}; | ||
const featureFlagMock = (server) => { | ||
server.db.loadData({ feature_flags: data.feature_flags }); | ||
server.get("/api/v1/configuration", () => { | ||
const features = server.db.feature_flags.find(1); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const other = __rest(features, ["id"]); | ||
const apiResponse = { | ||
feature_flags: other, | ||
}; | ||
return (new Response(200, { "x-version": "0" }, Object.assign({}, apiResponse)) || | ||
new Response(401, {}, { error: "Something went wrong" })); | ||
}, { timing: 1000 }); | ||
return server; | ||
}; | ||
const DEFAULT_MOCK_MIDDLEWARES = [ | ||
@@ -598,2 +654,3 @@ configurationMock, | ||
testErrorMock, | ||
featureFlagMock, | ||
]; | ||
@@ -612,2 +669,2 @@ | ||
export { APPLICATIONS_LIST, DEFAULT_MOCK_MIDDLEWARES, IDENTITY_JWT_SECRET, IDENTITY_LOGIN_URL, IDENTITY_PROFILE_URL, applicationsMock, configurationMock, createMockServer, identityMock }; | ||
export { APPLICATIONS_LIST, DEFAULT_MOCK_MIDDLEWARES, IDENTITY_JWT_SECRET, IDENTITY_LOGIN_URL, IDENTITY_PROFILE_URL, applicationsMock, configurationMock, createMockServer, featureFlagMock, identityMock }; |
@@ -372,3 +372,3 @@ 'use strict'; | ||
const configurationMock = (server) => { | ||
server.get(`/api/v1/configuration`, (schema, request) => { | ||
server.get(`/api/v1/globalconfiguration`, (schema, request) => { | ||
const session = getSessionFromRequest(request); | ||
@@ -598,2 +598,58 @@ const publicConfig = { | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function __rest(s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
} | ||
const data = { | ||
feature_flags: { | ||
home: true, | ||
private: true, | ||
form: false, | ||
dialog: false, | ||
internal: true, | ||
"private-2": false, | ||
users: true, | ||
classes: true, | ||
cashierGroups: true, | ||
posPermissions: true, | ||
}, | ||
}; | ||
const featureFlagMock = (server) => { | ||
server.db.loadData({ feature_flags: data.feature_flags }); | ||
server.get("/api/v1/configuration", () => { | ||
const features = server.db.feature_flags.find(1); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const other = __rest(features, ["id"]); | ||
const apiResponse = { | ||
feature_flags: other, | ||
}; | ||
return (new miragejs.Response(200, { "x-version": "0" }, Object.assign({}, apiResponse)) || | ||
new miragejs.Response(401, {}, { error: "Something went wrong" })); | ||
}, { timing: 1000 }); | ||
return server; | ||
}; | ||
const DEFAULT_MOCK_MIDDLEWARES = [ | ||
@@ -604,2 +660,3 @@ configurationMock, | ||
testErrorMock, | ||
featureFlagMock, | ||
]; | ||
@@ -626,2 +683,3 @@ | ||
exports.createMockServer = createMockServer; | ||
exports.featureFlagMock = featureFlagMock; | ||
exports.identityMock = identityMock; |
{ | ||
"name": "@ticketmaster/allure-mock", | ||
"version": "4.0.9", | ||
"version": "4.0.10", | ||
"author": "Ticketmaster (https://www.ticketmaster.com/)", | ||
@@ -17,3 +17,3 @@ "contributors": [ | ||
"devDependencies": { | ||
"@ticketmaster/allure-command": "^4.0.9" | ||
"@ticketmaster/allure-command": "^4.0.10" | ||
}, | ||
@@ -20,0 +20,0 @@ "peerDependencies": { |
@@ -39,2 +39,3 @@ # @ticketmaster/allure-mock | ||
import { identityMock } from "@ticketmaster/allure-mock"; | ||
import { featureFlagMock } from "@ticketmaster/allure-mock"; | ||
@@ -50,2 +51,3 @@ export const createMockServer = ({ environment = "test" } = {}): Server => { | ||
identityMock(server); | ||
featureFlagMock(server); | ||
@@ -52,0 +54,0 @@ // Allow unhandled requests to pass through |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63171
22
1487
80