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

[@dhealthdapps/frontend] fix(screens): restore setInterval authentica… #123

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ export default class LoginScreen extends MetaView {
*/
public get getMobileOS() {
const ua = navigator.userAgent;

if (/android/i.test(ua)) {
return "Android";
} else if (
Expand Down
36 changes: 36 additions & 0 deletions runtime/dapp-frontend-vue/tests/unit/views/LoginScreen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,40 @@ describe("LoginScreen -->", () => {
// expect(widget.find(".qr-code").exists()).to.be.true;
expect(widget.vm.createLoginQRCode()).to.be.not.null;
});

it("should not call call login setInterval if device not mobile", () => {
expect(widget.vm.mobileFetchTimer).to.be.undefined;
});

it("should call call login setInterval if device is mobile", () => {
const mobileOptions = {
localVue,
stubs: ["router-link"],
mocks: {
getImageUrl,
$route: { params: {} },
$router: {
push: jest.fn(),
},
$t: jest.fn(),
$store: {
dispatch: jest.fn(),
commit: jest.fn(),
getters: {
"auth/isAuthenticated": true,
"auth/getChallenge": "rwrwer",
"auth/getAuthRegistry": "fake-registry",
"auth/getRefCode": undefined,
},
},
computed: {
getMobileOS() {
return "iOS";
},
},
},
};

expect(widget.vm.getMobileOs).to.be.not.null;
});
});