SponsorBlockServer/test/mocks/gumroadMock.ts
2022-09-25 02:05:51 -04:00

22 lines
573 B
TypeScript

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()}`;