Skip to content

Commit

Permalink
chore: lint header (#3660)
Browse files Browse the repository at this point in the history
* chore: lint header

* fix: remove unused arguments
  • Loading branch information
sirtawast authored Dec 20, 2024
1 parent a0db079 commit a880d16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
import Header from '@frontend/shared/browser-tests/page-models/Header';
import { DEFAULT_LANGUAGE } from '@frontend/shared/src/i18n/i18n';
import User from '@frontend/shared/src/types/user';
import TestController from 'testcafe';

import getEmployerTranslationsApi from '../../src/__tests__/utils/i18n/get-employer-translations-api';

Expand All @@ -18,6 +17,6 @@ export const doEmployerLogin = async (
await header.userIsLoggedOut();
await header.clickLoginButton();
const suomiFiData = await doLogin(t, lang, cachedUser);
await header.userIsLoggedIn(suomiFiData.user ?? cachedUser);
await header.userIsLoggedIn();
return suomiFiData;
};
14 changes: 4 additions & 10 deletions frontend/shared/browser-tests/page-models/Header.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Selector, t } from 'testcafe';

import TranslationsApi from '../../src/__tests__/types/translations';
import isRealIntegrationsEnabled from '../../src/flags/is-real-integrations-enabled';
import { Language } from '../../src/i18n/i18n';
import User from '../../src/types/user';
import TranslatedComponent, { CommonTranslations } from './TranslatedComponent';

class Header<
Expand All @@ -15,15 +13,10 @@ class Header<
}

private withinNavigationActions = this.within(
// eslint-disable-next-line no-secrets/no-secrets
Selector('div[class*="HeaderActionBar-module_headerActions"]')
);

private getUserInfo(user?: User): string {
return `${
isRealIntegrationsEnabled() ? 'Mika Hietanen' : user?.name ?? ''
}`;
}

private headerTitle(): Selector {
return this.within(this.component.findByRole('banner'))
.findAllByText(this.translations.appName)
Expand All @@ -47,6 +40,7 @@ class Header<
});
}

// eslint-disable-next-line class-methods-use-this
private userInfoDropdown(): Selector {
return Selector('button').withAttribute(
'aria-controls',
Expand All @@ -60,7 +54,7 @@ class Header<
});
}

public userIsLoggedIn(user?: User): Promise<void> {
public userIsLoggedIn(): Promise<void> {
return this.expect(this.userInfoDropdown());
}

Expand All @@ -76,7 +70,7 @@ class Header<
return t.click(this.loginButton());
}

public async clickLogoutButton(user?: User): Promise<void> {
public async clickLogoutButton(): Promise<void> {
return t.click(this.userInfoDropdown()).click(this.logoutButton());
}
}
Expand Down

0 comments on commit a880d16

Please sign in to comment.