Skip to content

Commit

Permalink
Small formating and naming cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jkasten2 committed Feb 19, 2021
1 parent 46fca9a commit 4516c35
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/managers/ServiceWorkerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class ServiceWorkerManager {
if (!serviceWorker) {
return null;
}

const workerScriptPath = new URL(serviceWorker.scriptURL).pathname;
const swFileName = new Path(workerScriptPath).getFileName();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MockServiceWorkerRegistration } from "./MockServiceWorkerRegistration";

// abstract to indicate this isn't designed to be used directly as part of the tests. (expect for the meta one)
// This is a generic mock.
// - no OneSignal specifics, see MockServiceWorkerContainerWithAPIBan
// - no OneSignal specifics, see MockServiceWorkerContainerWithAPIBan
export abstract class MockServiceWorkerContainer implements ServiceWorkerContainer {
protected _controller: ServiceWorker | null;
get controller(): ServiceWorker | null {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class MockServiceWorkerContainerWithAPIBan extends MockServiceWorkerConta
constructor() {
super();
}

get controller(): ServiceWorker | null {
throw new Error("Don't use, assumes page control!");
}
Expand Down Expand Up @@ -43,4 +43,4 @@ export class MockServiceWorkerContainerWithAPIBan extends MockServiceWorkerConta
throw new Error("Don't use, assumes page control!");
}
}
}
}
2 changes: 1 addition & 1 deletion test/unit/helpers/page/ServiceWorkerUtilHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ test('getAvailableServiceWorker() - returns null - when no ServiceWorker', async
t.falsy(ServiceWorkerUtilHelper.getAvailableServiceWorker(serviceWorkerRegistration))
});

// See test/unit/manager/ServiceWorkerManager.ts for other tests that cover this class
// See test/unit/manager/ServiceWorkerManager.ts for other tests that cover this class
11 changes: 5 additions & 6 deletions test/unit/meta/mockPushManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ test('mock push manager should subscribe successfully', async t => {

test('mock push manager should unsubscribe successfully', async t => {
const registration = await getServiceWorkerRegistration();

const subscribedSubscription = await registration!.pushManager.subscribe({
const subscription = await registration!.pushManager.subscribe({
userVisibleOnly: true,
applicationServerKey: Random.getRandomUint8Array(64).buffer
});
await subscribedSubscription.unsubscribe();
const subscription = await registration!.pushManager.getSubscription();
t.is(subscription, null);
});
await subscription.unsubscribe();

const subscriptionToCheck = await registration!.pushManager.getSubscription();
t.is(subscriptionToCheck, null);
});

0 comments on commit 4516c35

Please sign in to comment.