pierrejeambrun commented on code in PR #45607:
URL: https://github.com/apache/airflow/pull/45607#discussion_r1922024020
##########
airflow/ui/src/utils/AppWrapper.tsx:
##########
Review Comment:
This is really similar to the `Wrapper.tsx` Component. There's just the
`router` part that is different. I don't think we need both of them. Just the
`AppWrapper` should be enough. If we do need both, we can always re-use one
inside of the other. (nest components and use `{children}` to render the extra
` <RouterProvider router={router} />` part)
##########
airflow/ui/src/utils/AppWrapper.tsx:
##########
@@ -0,0 +1,50 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { ChakraProvider, defaultSystem } from "@chakra-ui/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { RouterProvider } from "react-router-dom";
+import { createMemoryRouter } from "react-router-dom";
Review Comment:
nit: this import can be merged.
##########
airflow/ui/src/pages/DagsList/DagsList.test.tsx:
##########
@@ -0,0 +1,49 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import "@testing-library/jest-dom";
+import { render, screen, waitFor } from "@testing-library/react";
+import { setupServer, type SetupServerApi } from "msw/node";
+import { afterEach, describe, it, expect, beforeAll, afterAll } from "vitest";
+
+import { handlers } from "src/mocks/handlers";
+import { AppWrapper } from "src/utils/AppWrapper";
+
+let server: SetupServerApi;
+
+beforeAll(() => {
+ server = setupServer(...handlers);
+ server.listen({ onUnhandledRequest: "bypass" });
+});
+
+afterEach(() => server.resetHandlers());
+afterAll(() => server.close());
Review Comment:
Maybe this setup code should be in the jest setup part ?
Because I am afraid that this will be duplicated in all tests that need the
msw mock server.
##########
airflow/ui/src/pages/DagsList/DagsList.test.tsx:
##########
@@ -0,0 +1,49 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import "@testing-library/jest-dom";
+import { render, screen, waitFor } from "@testing-library/react";
+import { setupServer, type SetupServerApi } from "msw/node";
+import { afterEach, describe, it, expect, beforeAll, afterAll } from "vitest";
+
+import { handlers } from "src/mocks/handlers";
+import { AppWrapper } from "src/utils/AppWrapper";
+
+let server: SetupServerApi;
+
+beforeAll(() => {
+ server = setupServer(...handlers);
+ server.listen({ onUnhandledRequest: "bypass" });
+});
+
+afterEach(() => server.resetHandlers());
+afterAll(() => server.close());
+
+describe("Dag Filters", () => {
+ it("Filter by selected last run state", async () => {
+ render(<AppWrapper initialEntries={["/dags"]} />);
+
+ await waitFor(() =>
expect(screen.getByTestId("dags-success-filter")).toBeInTheDocument());
+ await waitFor(() => screen.getByTestId("dags-success-filter").click());
+ await waitFor(() =>
expect(screen.getByText(/tutorial_taskflow_api_success/iu)).toBeInTheDocument());
Review Comment:
Where is the suffix `/iu` coming from ?
I was expecting just the `/tutorial_taskflow_api_success` to be in the
document.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]