
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@ticketmaster/allure-mock
Advanced tools
Allure common mocking solution library.
This library is a collection of shared mocking middlewares to mock shared services inside an Allure project.
First, you need to install the dependencies.
yarn add @ticketmaster/allure-mock -D
If you don't already have one, you have to create a function to instantiate a mock server. This function will be called later if we need to mock calls.
We recommend to put this file at the root of your src
folder and call it middleware.ts
.
// src/middleware.ts
import { NextRequest, NextResponse } from "next/server";
import createMiddleware from "next-intl/middleware";
import { AVAILABLE_LOCALES, DEFAULT_LOCALE } from "./config";
import {
applicationsMockApi,
identityMockApi,
} from "@ticketmaster/allure-mock";
export function middleware(request: NextRequest) {
const handleI18nRouting = createIntlMiddleware({
locales: AVAILABLE_LOCALES,
defaultLocale: DEFAULT_LOCALE,
localeDetection: true,
});
const response = handleI18nRouting(request);
export const config = {
matcher: [
"/((?!_next).*)", // do not localize next.js paths
`/api/v1/:path*`, // Limit the middleware to paths starting with `/api/v1`
],
};
export function middleware(req: NextRequest) {
if (process.env.NODE_ENV === "development") {
const { pathname } = request.nextUrl;
const endpointsMap: {
[key: string]: (nextRequest: NextRequest) => Promise<NextResponse>;
} = {
"/applications": applicationsMockApi,
"/sessions/logout": identityMockApi,
"/systems": identityMockApi,
"/token/refresh": identityMockApi,
"/token/verify": identityMockApi,
};
if (pathname.startsWith("/api/v1")) {
const path = pathname.split("/api/v1");
const endpoint = path.length > 0 ? path[1] : "";
for (const [key, value] of Object.entries(endpointsMap)) {
if (endpoint.match(key)) {
return value(request);
}
}
}
}
return NextResponse.next();
}
FAQs
Allure common mocking solution library
The npm package @ticketmaster/allure-mock receives a total of 0 weekly downloads. As such, @ticketmaster/allure-mock popularity was classified as not popular.
We found that @ticketmaster/allure-mock demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 33 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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.