PromucFlow_constructor/app/client/src/usagePulse/usagePulse.test.ts
Ankit Srivastava 1c56186b53
fix: sending usage pulse when the app is private and user is logged in. (#22933)
Today, when we open a private app, and the user is not logged in. We
send the usage pulse and then redirect the user to the login page.

After this fix, if we hit a private app URL and the user is logged in,
we will send the pulse or else redirect to the login page without
sending a pulse.

Fixes # https://github.com/appsmithorg/cloud-services/issues/763


## Type of change
- Bug fix (non-breaking change which fixes an issue)


## How Has This Been Tested?
- Manual

### Test Plan
> Add Testsmith test cases links that relate to this PR

### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)


## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-05-08 14:33:21 +05:30

33 lines
898 B
TypeScript

import UsagePulse from "usagePulse";
describe("Usage pulse", () => {
describe("isTrackableUrl", () => {
it("should return true when called with trackable URL", () => {
// All application URLS are trackable.
[
"/app/test/mypage-123123/edit",
"/app/test/mypage-123123",
"/app/test-123123/edit",
"/app/test-123123",
"/applications/123123test/pages/123123test/edit",
"/applications/123123test/pages/123123test",
].forEach((url) => {
expect(UsagePulse.isTrackableUrl(url)).toBeTruthy();
});
});
it("should return false when called with untrackable URL", () => {
[
"/applications",
"/login",
"/signup",
"/settings",
"/generate-page",
].forEach(async (url) => {
expect(await UsagePulse.isTrackableUrl(url)).toBeFalsy();
});
});
});
});