Skip to content

Commit

Permalink
Revert "accept prettier client improves codecov"
Browse files Browse the repository at this point in the history
This reverts commit 924a5cd.
  • Loading branch information
lindot11 committed Nov 29, 2023
1 parent a485676 commit 7e22cd7
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 35 deletions.
3 changes: 1 addition & 2 deletions client/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"singleQuote": true,
"trailingComma": "all"
"singleQuote": true
}
4 changes: 2 additions & 2 deletions client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const router = createBrowserRouter(
],
{
basename: `/${useURLbasename()}`,
},
}
);

const root = document.getElementById('root');
Expand All @@ -68,7 +68,7 @@ if (root) {
<AppProvider>
<RouterProvider router={router} />
</AppProvider>
</React.StrictMode>,
</React.StrictMode>
);
} else {
throw Error("Couldn't find root element");
Expand Down
4 changes: 2 additions & 2 deletions client/test/e2e/playwright/Auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test.describe('Tests on Authentication Flow', () => {
.getByRole('button', { name: 'GitLab logo Sign In with GitLab' })
.click();
await expect(
page.getByRole('button', { name: 'Open settings' }),
page.getByRole('button', { name: 'Open settings' })
).toBeVisible();
await expect(page).toHaveURL(/.*Library/);
});
Expand All @@ -23,7 +23,7 @@ test.describe('Tests on Authentication Flow', () => {
.getByRole('button', { name: 'GitLab logo Sign In with GitLab' })
.click();
await expect(
page.getByRole('button', { name: 'Open settings' }),
page.getByRole('button', { name: 'Open settings' })
).toBeVisible();
await expect(page).toHaveURL(/.*Library/);

Expand Down
4 changes: 2 additions & 2 deletions client/test/e2e/playwright/Menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test.describe('Menu Links from first page (Layout)', () => {
.getByRole('button', { name: 'GitLab logo Sign In with GitLab' })
.click();
await expect(
page.getByRole('button', { name: 'Open settings' }),
page.getByRole('button', { name: 'Open settings' })
).toBeVisible();
await expect(page).toHaveURL(/.*Library/);
});
Expand All @@ -19,7 +19,7 @@ test.describe('Menu Links from first page (Layout)', () => {
await links.reduce(async (previousPromise, link) => {
await previousPromise;
const linkElement = await page.locator(
`div[role="button"]:has-text("${link.text}")`,
`div[role="button"]:has-text("${link.text}")`
);
await expect(linkElement).toBeVisible();
}, Promise.resolve());
Expand Down
2 changes: 1 addition & 1 deletion client/test/e2e/playwright/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ setup('authenticate', async ({ page }) => {
// 'Authorize' button did not appear within 4 seconds, so just ignore and continue.
}
await expect(
page.getByRole('button', { name: 'Open settings' }),
page.getByRole('button', { name: 'Open settings' })
).toBeVisible();

const storage = await page.context().storageState();
Expand Down
4 changes: 2 additions & 2 deletions client/test/integration/authRedux.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const setupTest = (authState: AuthState) => {
<PrivateRoute>
<Library />
</PrivateRoute>,
{ route: '/private', store },
{ route: '/private', store }
);
};

Expand All @@ -75,7 +75,7 @@ describe('Redux and Authentication integration test', () => {

expect(screen.getByText('Signin')).toBeInTheDocument();
expect(authReducer(undefined, { type: 'unknown' })).toEqual(
initialState.auth,
initialState.auth
);
expect(store.getState().userName).toBe(undefined);
});
Expand Down
6 changes: 3 additions & 3 deletions client/test/unitTests/Components/Linkbuttons.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const getButtonIcon = (key: string) =>
const evaluateButtonSize = (expectedSize: number) => {
buttons.forEach((button) => {
expect(
getComputedStyle(getButtonIcon(button.key)).getPropertyValue('font-size'),
getComputedStyle(getButtonIcon(button.key)).getPropertyValue('font-size')
).toBe(`${expectedSize}rem`);
});
};
Expand All @@ -38,7 +38,7 @@ describe('LinkButtons component default size', () => {
buttons.forEach((button) => {
expect(getButton(button.key).parentElement).toHaveAttribute(
'aria-label',
button.link,
button.link
);
expect(getLabel(button.key).tagName).toBe('H6');
});
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('LinkButtons component default size', () => {

it('should use name from iconLib as label when avaiable', () => {
expect(getLabel(buttons[0].key).textContent).toBe(
LinkIcons[buttons[0].key].name,
LinkIcons[buttons[0].key].name
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion client/test/unitTests/Components/PrivateRoute.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const setupTest = (authState: AuthState) => {
<PrivateRoute>
<TestComponent />
</PrivateRoute>,
{ route: '/private' },
{ route: '/private' }
);
};

Expand Down
2 changes: 1 addition & 1 deletion client/test/unitTests/Page/LayoutPublic.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const PublicTestComponentId = 'public-component';

describe('LayoutPublic component with one element', () => {
beforeEach(() =>
renderLayoutWithRouter(LayoutPublic, [PublicTestComponentId]),
renderLayoutWithRouter(LayoutPublic, [PublicTestComponentId])
);

basicLayoutTestsWithSingleComponent();
Expand Down
2 changes: 1 addition & 1 deletion client/test/unitTests/Page/page.testUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TestComponentIdList = ['component1', 'component2', 'component3'];

export function renderLayoutWithRouter(
Layout: (props: { children: React.ReactElement[] }) => React.ReactElement,
Children: string[],
Children: string[]
) {
render(<Layout>{generateTestDivs(Children)}</Layout>, {
wrapper: BrowserRouter,
Expand Down
2 changes: 1 addition & 1 deletion client/test/unitTests/Routes/Library.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Library with no props', () => {
InitRouteTests(
<AuthProvider>
<Library />
</AuthProvider>,
</AuthProvider>
);

itDisplaysContentOfTabs(assetType);
Expand Down
6 changes: 3 additions & 3 deletions client/test/unitTests/Routes/SignIn.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ describe('SignIn', () => {
render(
<MemoryRouter>
<SignIn />
</MemoryRouter>,
</MemoryRouter>
);

expect(
screen.getByRole('button', { name: /Sign In With GitLab/i }),
screen.getByRole('button', { name: /Sign In With GitLab/i })
).toBeInTheDocument();
});

it('handles button click', () => {
render(
<MemoryRouter>
<SignIn />
</MemoryRouter>,
</MemoryRouter>
);

const signInButton = screen.getByRole('button', {
Expand Down
6 changes: 3 additions & 3 deletions client/test/unitTests/Util/Store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ describe('reducers', () => {
describe('menu reducer', () => {
const itShouldHandleMenuActions = (
actionCreator: () => { type: string },
expectedValue: boolean,
expectedValue: boolean
) => {
const newState = menuReducer(initialState.menu, actionCreator());
expect(newState.isOpen).toBe(expectedValue);
};

it('menuReducer should return the initial menu state when an unknown action type is passed with an undefined state', () => {
expect(menuReducer(undefined, { type: 'unknown' })).toEqual(
initialState.menu,
initialState.menu
);
});

Expand All @@ -50,7 +50,7 @@ describe('reducers', () => {
describe('auth reducer', () => {
it('authReducer should return the initial menu state when an unknown action type is passed with an undefined state', () => {
expect(authReducer(undefined, { type: 'unknown' })).toEqual(
initialState.auth,
initialState.auth
);
});

Expand Down
12 changes: 6 additions & 6 deletions client/test/unitTests/Util/envUtil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ describe('envUtil', () => {

test('GetURL should return the correct enviroment variables', () => {
expect(useURLforDT()).toBe(
`${testAppURL}/${testBasename}/${testUsername}/${testDT}`,
`${testAppURL}/${testBasename}/${testUsername}/${testDT}`
);
expect(useURLforLIB()).toBe(
`${testAppURL}/${testBasename}/${testUsername}/${testLIB}`,
`${testAppURL}/${testBasename}/${testUsername}/${testLIB}`
);
expect(useURLbasename()).toBe(testBasename);
});
Expand All @@ -71,8 +71,8 @@ describe('envUtil', () => {
const result = getWorkbenchLinkValues();
expect(
result.every(
(el) => typeof el.key === 'string' && typeof el.link === 'string',
),
(el) => typeof el.key === 'string' && typeof el.link === 'string'
)
).toBe(true);
});

Expand All @@ -83,8 +83,8 @@ describe('envUtil', () => {
result.forEach((el, i) => {
expect(el.link).toEqual(
`${testAppURL}/${testBasename}/${testUsername}/${cleanURL(
testWorkbenchEndpoints[i],
)}`,
testWorkbenchEndpoints[i]
)}`
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion client/test/unitTests/auth/AuthProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('AuthProvider', () => {
const { getByText } = renderAuthProvider(<DummyComponent />);

expect(
getByText('Authentication service unavailable...try again later'),
getByText('Authentication service unavailable...try again later')
).toBeInTheDocument();
});

Expand Down
8 changes: 4 additions & 4 deletions client/test/unitTests/testUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ type RouterOptions = {

export const renderWithRouter = (
ui: React.ReactElement,
{ route = '/', store }: RouterOptions = {},
{ route = '/', store }: RouterOptions = {}
) => {
window.history.pushState({}, 'Test page', route);

return store
? render(
<Provider store={store}>
<RouterComponent ui={ui} route={route} />
</Provider>,
</Provider>
)
: render(<RouterComponent ui={ui} route={route} />);
};
Expand Down Expand Up @@ -65,7 +65,7 @@ export function InitRouteTests(component: React.ReactElement) {
}

export function itDisplaysContentOfTabs(
tabs: { label: string; body: string }[],
tabs: { label: string; body: string }[]
) {
it('should render labels of all tabs', () => {
tabs.forEach((tab) => {
Expand Down Expand Up @@ -117,7 +117,7 @@ export interface TabLabelURLPair {
}

export function itHasCorrectURLOfTabsWithIframe(
tablabelsURLpair: TabLabelURLPair[],
tablabelsURLpair: TabLabelURLPair[]
) {
it('should render the Iframe component for the first tab with the correct title and URL', () => {
tablabelsURLpair.forEach((tablabelURLpair) => {
Expand Down

0 comments on commit 7e22cd7

Please sign in to comment.