mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-06 11:36:58 +03:00
add getIP test cases, misc others
This commit is contained in:
33
test/mocks/mockExpressRequest.ts
Normal file
33
test/mocks/mockExpressRequest.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
const nullStub = (): any => null;
|
||||
|
||||
export const createRequest = (options: any) => ({
|
||||
app: {},
|
||||
baseUrl: "",
|
||||
body: {},
|
||||
cookies: {},
|
||||
fresh: true,
|
||||
headers: {},
|
||||
hostname: "example.com",
|
||||
ip: "",
|
||||
ips: [],
|
||||
method: "GET",
|
||||
originalUrl: "/",
|
||||
params: {},
|
||||
path: "/",
|
||||
protocol: "https",
|
||||
query: {},
|
||||
route: {},
|
||||
secure: true,
|
||||
signedCookies: {},
|
||||
stale: false,
|
||||
subdomains: [],
|
||||
xhr: true,
|
||||
accepts: nullStub(),
|
||||
acceptsCharsets: nullStub(),
|
||||
acceptsEncodings: nullStub(),
|
||||
acceptsLanguages: nullStub(),
|
||||
get: nullStub(),
|
||||
is: nullStub(),
|
||||
range: nullStub(),
|
||||
...options
|
||||
});
|
||||
Reference in New Issue
Block a user