Skip to content

Commit

Permalink
chore: Fix last path-to-regexp depenabot alert by using `vite previ…
Browse files Browse the repository at this point in the history
…ew` instead of `serve` (#11015)

* attempt 1

* allow any host

* re-add skip

* re-add skip

* add changeset

---------

Co-authored-by: Banks Nussman <[email protected]>
  • Loading branch information
bnussman-akamai and bnussman authored Sep 27, 2024
1 parent d5a2272 commit 0bc9d73
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 302 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tech Stories
---

Fix last `path-to-regexp` depenabot alert ([#11015](https://github.com/linode/manager/pull/11015))
3 changes: 1 addition & 2 deletions packages/manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"scripts": {
"start": "concurrently --raw \"vite\" \"tsc --watch --preserveWatchOutput\"",
"start:expose": "concurrently --raw \"vite --host\" \"tsc --watch --preserveWatchOutput\"",
"start:ci": "yarn serve ./build -p 3000 -s --cors",
"start:ci": "vite preview --port 3000 --host",
"lint": "yarn run eslint . --ext .js,.ts,.tsx --quiet",
"build": "vite build",
"build:analyze": "bunx vite-bundle-visualizer",
Expand Down Expand Up @@ -199,7 +199,6 @@
"msw": "^2.2.3",
"prettier": "~2.2.1",
"redux-mock-store": "^1.5.3",
"serve": "^14.0.1",
"simple-git": "^3.19.0",
"storybook": "^8.3.0",
"storybook-dark-mode": "4.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@ import { Security } from './Security';
import type { LinodeCreateFormValues } from './utilities';

describe('Security', () => {
it(
'should render a root password input',
async () => {
const { findByLabelText } = renderWithThemeAndHookFormContext({
component: <Security />,
});
// TODO: Unskip once M3-8559 is addressed.
it.skip('should render a root password input', async () => {
const { findByLabelText } = renderWithThemeAndHookFormContext({
component: <Security />,
});

const rootPasswordInput = await findByLabelText('Root Password');
const rootPasswordInput = await findByLabelText('Root Password');

expect(rootPasswordInput).toBeVisible();
expect(rootPasswordInput).toBeEnabled();
},
{ timeout: 5_000 }
);
expect(rootPasswordInput).toBeVisible();
expect(rootPasswordInput).toBeEnabled();
});

it('should render a SSH Keys heading', async () => {
const { getAllByText } = renderWithThemeAndHookFormContext({
Expand All @@ -54,35 +51,32 @@ describe('Security', () => {
expect(addSSHKeyButton).toBeEnabled();
});

it(
'should disable the password input if the user does not have permission to create linodes',
async () => {
server.use(
http.get('*/v4/profile', () => {
return HttpResponse.json(profileFactory.build({ restricted: true }));
}),
http.get('*/v4/profile/sshkeys', () => {
return HttpResponse.json(makeResourcePage([]));
}),
http.get('*/v4/profile/grants', () => {
return HttpResponse.json(
grantsFactory.build({ global: { add_linodes: false } })
);
})
);

const { findByLabelText } = renderWithThemeAndHookFormContext({
component: <Security />,
});

const rootPasswordInput = await findByLabelText('Root Password');

await waitFor(() => {
expect(rootPasswordInput).toBeDisabled();
});
},
{ timeout: 5_000 }
);
// TODO: Unskip once M3-8559 is addressed.
it.skip('should disable the password input if the user does not have permission to create linodes', async () => {
server.use(
http.get('*/v4/profile', () => {
return HttpResponse.json(profileFactory.build({ restricted: true }));
}),
http.get('*/v4/profile/sshkeys', () => {
return HttpResponse.json(makeResourcePage([]));
}),
http.get('*/v4/profile/grants', () => {
return HttpResponse.json(
grantsFactory.build({ global: { add_linodes: false } })
);
})
);

const { findByLabelText } = renderWithThemeAndHookFormContext({
component: <Security />,
});

const rootPasswordInput = await findByLabelText('Root Password');

await waitFor(() => {
expect(rootPasswordInput).toBeDisabled();
});
});

it('should disable ssh key selection if the user does not have permission to create linodes', async () => {
const sshKeys = sshKeyFactory.buildList(3);
Expand Down
Loading

0 comments on commit 0bc9d73

Please sign in to comment.