Skip to content

Commit

Permalink
test notifiers also without a provided URL
Browse files Browse the repository at this point in the history
  • Loading branch information
laur89 committed Feb 6, 2025
1 parent 1a50eaa commit 9ea146b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/device-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export class DeviceLogin {
pendingRedirects.set(reqId, this.onTestVisit(resolve, reject).bind(this));
}),
),
await this.notify(NotificationReason.TEST, url),
await this.notify(NotificationReason.TEST_WITH_URL, url),
await this.notify(NotificationReason.TEST_WITHOUT_URL),
]);
pendingRedirects.delete(reqId);
}
Expand All @@ -172,14 +173,9 @@ export class DeviceLogin {
pendingRedirects.delete(reqId);
}

private async notify(reason: NotificationReason, inUrl?: string): Promise<void> {
let url: string | undefined;
if (inUrl) {
if (config.webPortalConfig?.localtunnel) {
url = await getLocaltunnelUrl(inUrl);
} else {
url = inUrl;
}
private async notify(reason: NotificationReason, url?: string): Promise<void> {
if (url && config.webPortalConfig?.localtunnel) {
url = await getLocaltunnelUrl(url);

Check failure on line 178 in src/device-login.ts

View workflow job for this annotation

GitHub Actions / lint

Assignment to function parameter 'url'
}
this.L.info({ reason, url }, 'Dispatching notification');
await sendNotification(this.user, reason, url);
Expand Down
3 changes: 2 additions & 1 deletion src/interfaces/notification-reason.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export enum NotificationReason {
LOGIN = 'LOGIN',
PURCHASE = 'PURCHASE',
CREATE_ACCOUNT = 'CREATE_ACCOUNT',
TEST = 'TEST',
TEST_WITH_URL = 'TEST_WITH_URL',
TEST_WITHOUT_URL = 'TEST_WITHOUT_URL',
PURCHASE_ERROR = 'PURCHASE ERROR',
}

0 comments on commit 9ea146b

Please sign in to comment.