mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-31 11:56:27 +03:00
add token tests
This commit is contained in:
22
test/mocks/gumroadMock.ts
Normal file
22
test/mocks/gumroadMock.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export const licenseSuccess = {
|
||||
success: true,
|
||||
uses: 4,
|
||||
purchase: {}
|
||||
};
|
||||
|
||||
export const licenseFail = {
|
||||
success: false,
|
||||
message: "That license does not exist for the provided product."
|
||||
};
|
||||
|
||||
|
||||
const subCode = (length = 8) => {
|
||||
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
let result = "";
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += characters[(Math.floor(Math.random() * characters.length))];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export const generateLicense = (): string => `${subCode()}-${subCode()}-${subCode()}-${subCode()}`;
|
||||
Reference in New Issue
Block a user