Skip to content

Commit

Permalink
Fix tests and global axios paramsSerializer to null
Browse files Browse the repository at this point in the history
  • Loading branch information
vchiapaikeo committed Dec 1, 2023
1 parent 69ac592 commit 777580f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 7 additions & 0 deletions airflow/www/static/js/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ import useDags from "./useDags";
import useDagRuns from "./useDagRuns";
import useHistoricalMetricsData from "./useHistoricalMetricsData";

axios.interceptors.request.use((config) => {
config.paramsSerializer = {
indexes: null,
};
return config;
});

axios.interceptors.response.use((res: AxiosResponse) =>
res.data ? camelcaseKeys(res.data, { deep: true }) : res
);
Expand Down
1 change: 0 additions & 1 deletion airflow/www/static/js/api/useGridData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ const useGridData = () => {
};
const response = await axios.get<AxiosResponse, GridData>(gridDataUrl, {
params,
paramsSerializer: { indexes: null },
});
// turn off auto refresh if there are no active runs
if (!areActiveRuns(response.dagRuns)) stopRefresh();
Expand Down
8 changes: 4 additions & 4 deletions airflow/www/static/js/dag/useFilters.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ describe("Test useFilters hook", () => {

expect(baseDate).toBe(date.toISOString());
expect(numRuns).toBe(global.defaultDagRunDisplayNumber.toString());
expect(runType).toBeNull();
expect(runState).toBeNull();
expect(runType).toEqual([]);
expect(runState).toEqual([]);
expect(root).toBeUndefined();
expect(filterUpstream).toBeUndefined();
expect(filterDownstream).toBeUndefined();
Expand Down Expand Up @@ -118,7 +118,7 @@ describe("Test useFilters hook", () => {
);
});

expect(result.current.filters[paramName]).toBe(paramValue);
expect(result.current.filters[paramName]).toEqual(paramValue);

// clearFilters
await act(async () => {
Expand All @@ -132,7 +132,7 @@ describe("Test useFilters hook", () => {
global.defaultDagRunDisplayNumber.toString()
);
} else {
expect(result.current.filters[paramName]).toBeNull();
expect(result.current.filters[paramName]).toEqual([]);
}
});

Expand Down

0 comments on commit 777580f

Please sign in to comment.