Skip to content

Commit

Permalink
fix: app reset does not get stuck on support screen (#1914)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSlimvReal authored Jul 3, 2023
1 parent b4e4d41 commit ab55a4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/app/core/support/support/support.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("SupportComponent", () => {
serviceWorker: { getRegistrations: () => [], ready: Promise.resolve() },
},
};
let mockLocation: jasmine.SpyObj<Location>;
let mockLocation: any;

beforeEach(async () => {
localStorage.clear();
Expand All @@ -49,7 +49,7 @@ describe("SupportComponent", () => {
mockDB.getPouchDB.and.returnValue({
info: () => Promise.resolve({ doc_count: 1, update_seq: 2 }),
} as any);
mockLocation = jasmine.createSpyObj(["reload"]);
mockLocation = {};
await TestBed.configureTestingModule({
imports: [
SupportComponent,
Expand Down Expand Up @@ -118,7 +118,7 @@ describe("SupportComponent", () => {
expect(mockDB.destroy).toHaveBeenCalled();
expect(unregisterSpy).toHaveBeenCalled();
expect(localStorage.getItem("someItem")).toBeNull();
expect(mockLocation.reload).toHaveBeenCalled();
expect(mockLocation.pathname).toBe("");
});

it("should display the service worker logs after they are available", fakeAsync(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/support/support/support.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class SupportComponent implements OnInit {
const unregisterPromises = registrations.map((reg) => reg.unregister());
await Promise.all(unregisterPromises);
localStorage.clear();
this.location.reload();
this.location.pathname = "";
}

async downloadLocalDatabase() {
Expand Down

0 comments on commit ab55a4e

Please sign in to comment.