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

Deploy from git #505

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
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
62 changes: 31 additions & 31 deletions jhub_apps/static/js/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ui/src/components/app-card/app-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
if (serverStatus) {
setAppStatus(serverStatus);
}
console.log('Current App:', app);

Check warning on line 79 in ui/src/components/app-card/app-card.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement

Check warning on line 79 in ui/src/components/app-card/app-card.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
}, [serverStatus, setNotification]);

// Fetch user data and check admin status
Expand Down
44 changes: 21 additions & 23 deletions ui/src/components/app-form/app-form.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,6 @@ describe('AppForm', () => {
});

describe('filepath field behavior based on query parameter', () => {
test('navigates to the URL with a filepath query parameter and checks the value of the filepath field in the form', async () => {
const testFilePath = '/path/to/test/file.ipynb';
const testUrl = `?filepath=${encodeURIComponent(testFilePath)}`;
window.history.pushState({}, 'Test Page', testUrl);

const { baseElement } = render(
<RecoilRoot>
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<AppForm />
</BrowserRouter>
</QueryClientProvider>
</RecoilRoot>,
);

const filePathField = baseElement.querySelector(
'#filepath',
) as HTMLInputElement;

expect(filePathField).toBeInTheDocument();
expect(filePathField.value).toBe(testFilePath);
});

test('navigates to the URL without a filepath query parameter and checks the value of the filepath field in the form', async () => {
const testUrl = '/';
window.history.pushState({}, 'Test Page', testUrl);
Expand Down Expand Up @@ -821,4 +798,25 @@ describe('AppForm', () => {
expect(window.location.pathname).not.toBe('/edit-app');
}
});
test('displays error when GitHub URL is invalid', async () => {
const { getByLabelText, getByText } = render(
<RecoilRoot>
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<AppForm deployOption="git" />
</BrowserRouter>
</QueryClientProvider>
</RecoilRoot>,
);

// Modify the label matcher to be more flexible with regex or use exact: false
const urlField = getByLabelText(/Git Repository URL/i, { exact: false });
const fetchButton = getByText('Fetch App Configuration');

await userEvent.type(urlField, 'invalid-url');
fireEvent.click(fetchButton);

const errorMessage = await getByText('Invalid GitHub URL');
expect(errorMessage).toBeInTheDocument();
});
});
Loading
Loading