Skip to content

Commit

Permalink
Update gumroad page link and add gh pages config
Browse files Browse the repository at this point in the history
  • Loading branch information
Zakinator123 committed Apr 19, 2023
1 parent 2bd7c57 commit d629f5b
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 8 deletions.
7 changes: 7 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
remote_theme: pages-themes/[email protected]
plugins:
- jekyll-remote-theme # add this line to the plugins list if you already have one

title: This is a test
description: [A short description of your site's purpose]
google_analytics: [Your Google Analytics tracking ID]
3 changes: 0 additions & 3 deletions src/components/ExtensionWithSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,8 @@ ol, ul {
- Increase test coverage of extension
- Purchase domain name(s)?
- Create email address with custom domain for support page
- Fix rate limiter tests being flaky
- Deploy a test version to ODC
- Use airtable form for support link?
- Give user option to remove license if expired so that they stop getting the error message
- Prevent user from reverifying an expired license (only let them reverify if they remove the license)
- Make form validation error messages that reference table names and/or field types more user friendly.
- Set up github sponsors page/info
Expand Down
2 changes: 1 addition & 1 deletion src/components/Premium.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export const Premium = ({
<Toast containerId={premiumToastContainerId}/>
<Box marginTop={3} display='flex' alignContent='center' justifyContent='center'>
<Link
href="https://airtablecheckoutcart.gumroad.com/l/checkout-cart"
href="https://zoftware.gumroad.com/l/checkoutcart"
target="_blank">
<Button variant='primary'>
Purchase License
Expand Down
141 changes: 141 additions & 0 deletions test/services/LicenseVerificationServiceTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
// import {jest, describe, expect, it, beforeEach} from '@jest/globals';
// import {GumroadLicenseVerificationService} from "../../src/services/LicenseVerificationService";
//
// describe('GumroadLicenseVerificationService', () => {
// const gumroadLicenseVerificationService = new GumroadLicenseVerificationService();
//
// const testResponse = {
// "success": true,
// "uses": 3,
// "purchase": {
// "seller_id": "kL0psVL2admJSYRNs-OCMg==",
// "product_id": "32-nPAicqbLj8B_WswVlMw==",
// "product_name": "licenses demo product",
// "permalink": "QMGY",
// "product_permalink": "https://sahil.gumroad.com/l/pencil",
// "email": "[email protected]",
// "price": 0,
// "gumroad_fee": 0,
// "currency": "usd",
// "quantity": 1,
// "discover_fee_charged": false,
// "can_contact": true,
// "referrer": "direct",
// "card": {
// "expiry_month": null,
// "expiry_year": null,
// "type": null,
// "visual": null
// },
// "order_number": 524459935,
// "sale_id": "FO8TXN-dbxYaBdahG97Y-Q==",
// "sale_timestamp": "2021-01-05T19:38:56Z",
// "purchaser_id": "5550321502811",
// "subscription_id": "GDzW4_aBdQc-o7Gbjng7lw==",
// "variants": "",
// "license_key": "85DB562A-C11D4B06-A2335A6B-8C079166",
// "is_multiseat_license": false,
// "ip_country": "United States",
// "recurrence": "monthly",
// "is_gift_receiver_purchase": false,
// "refunded": false,
// "disputed": false,
// "dispute_won": false,
// "id": "FO8TXN-dvaYbBbahG97a-Q==",
// "created_at": "2021-01-05T19:38:56Z",
// "custom_fields": [],
// "chargebacked": false,
// "subscription_ended_at": null,
// "subscription_cancelled_at": null,
// "subscription_failed_at": null
// }};
//
// global.fetch = (jest.fn(() =>
// Promise.resolve({
// json: () => Promise.resolve(testResponse),
// })
// )) as jest.Mock;
//
//
// // Test 1: Fetch throws an error
// it('should return unable-to-verify status when fetch throws an error', async () => {
// jest.spyOn(global, 'fetch').mockRejectedValue(new Error('Network error'));
// // @ts-ignore
// fetch.mockImplementationOnce(() => Promise.reject("API is down"));
//
// const result = await gumroadLicenseVerificationService.verifyLicense('test-license', true);
// expect(result).toEqual({
// premiumStatus: 'unable-to-verify',
// message: 'Unable to verify premium license. Please check your internet connection and reload the extension.',
// });
// });
//
// // Test 2: Response status is 404
// it('should return free status when response status is 404', async () => {
// const mockResponse = new Response(undefined, {status: 404});
// jest.spyOn(global, "fetch").mockImplementation(
// jest.fn(
// () => Promise.resolve({ json: () => Promise.resolve({ data: 100 }),
// }),
// ) as jest.Mock );
// // jest.spyOn(global, 'fetch').mockResolvedValue(mockResponse);
//
// const result = await gumroadLicenseVerificationService.verifyLicense('test-license', true);
//
// expect(result).toEqual({
// premiumStatus: 'invalid',
// message: 'Invalid premium license. Please check your license key and try again.',
// });
// });
//
// // Test 3: Response status is not 200 and not 404
// it('should return unable-to-verify status when response status is not 200 and not 404', async () => {
// const mockResponse = new Response(null, {status: 500});
// jest.spyOn(global, 'fetch').mockResolvedValue(mockResponse);
//
// const result = await gumroadLicenseVerificationService.verifyLicense('test-license', true);
//
// expect(result).toEqual({
// premiumStatus: 'unable-to-verify',
// message: 'Unable to verify premium license. The license verification service is not responding as expected. Please try again later or contact the developer for support.',
// });
// });
//
// // Test 4: Response JSON success is false
// it('should return free status when response JSON success is false', async () => {
// const mockResponse = new Response(JSON.stringify({success: false}), {status: 200});
// jest.spyOn(global, 'fetch').mockResolvedValue(mockResponse);
//
// const result = await gumroadLicenseVerificationService.verifyLicense('test-license', true);
//
// expect(result).toEqual({
// premiumStatus: 'invalid',
// message: 'Invalid premium license. Please check your license key and try again.',
// });
// });
//
// // Test 5: Subscription is no longer active
// it('should return expired status when subscription is no longer active', async () => {
// const mockResponseJson = {
// success: true,
// purchase: {
// subscription_ended_at: '2023-01-01',
// subscription_cancelled_at: null,
// subscription_failed_at: null,
// },
// };
//
// const mockResponse = new Response(JSON.stringify(mockResponseJson), {status: 200});
// jest.spyOn(global, 'fetch').mockResolvedValue(mockResponse);
//
// const result = await gumroadLicenseVerificationService.verifyLicense('test-license', true);
//
// expect(result).toEqual({
// premiumStatus: 'expired',
// message: 'Your premium subscription is no longer active. Purchase and verify a new subscription license to continue using premium features.',
// });
// });
//
// // Test 6: License has already been redeemed
// // it('should return free status when license has already been redeemed', async
// });
8 changes: 4 additions & 4 deletions test/utils/RateLimiter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('RateLimiter', () => {
}

return Promise.all(rateLimitedRequestPromises).then((endTimes) => {
endTimes.forEach((endTime) => expect(endTime - startTime).toBeLessThan(100))
endTimes.forEach((endTime) => expect(endTime - startTime).toBeLessThanOrEqual(100))
})
});

Expand All @@ -35,8 +35,8 @@ describe('RateLimiter', () => {
const endTime: number = endTimes[i] as number;

(i < 15)
? expect(endTime - startTime).toBeLessThan(100)
: expect(endTime - startTime).toBeGreaterThan(1000);
? expect(endTime - startTime).toBeLessThanOrEqual(100)
: expect(endTime - startTime).toBeGreaterThanOrEqual(1000);
}
})
});
Expand All @@ -51,7 +51,7 @@ describe('RateLimiter', () => {

return Promise.all(rateLimitedRequestPromises).then(endTimes => {
for (let i = 0; i < endTimes.length; i++) {
expect(endTimes[i]! - startTime).toBeGreaterThan(Math.floor(i / 15) * 1000);
expect(endTimes[i]! - startTime).toBeGreaterThanOrEqual(Math.floor(i / 15) * 1000);
}
})
});
Expand Down

0 comments on commit d629f5b

Please sign in to comment.