Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: app reset does not get stuck on support screen #1914

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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