Merge pull request #5801 from backstage/cost-insights-null-group-bugfix

fix(cost-insights): null groups in urls
This commit is contained in:
Fredrik Adelöw
2021-05-25 07:09:13 +02:00
committed by GitHub
3 changed files with 8 additions and 7 deletions
@@ -0,0 +1,5 @@
---
'@backstage/plugin-cost-insights': patch
---
fix for query parameters with null groups
@@ -61,7 +61,9 @@ describe.each`
params | expected
${''} | ${{}}
${'?foo=bar'} | ${{}}
${'?group'} | ${{ group: null }}
${'?project'} | ${{ project: null }}
${'?project&group'} | ${{ group: null, project: null }}
${'?group=some-group'} | ${{ group: 'some-group' }}
${'?group=some-group&project'} | ${{ group: 'some-group', project: null }}
${'?group=some-group&project=some-project'} | ${{ group: 'some-group', project: 'some-project' }}
@@ -72,9 +74,3 @@ describe.each`
expect(pageFilters).toMatchObject(expected);
});
});
describe('invalidate', () => {
it("should throw an error if param values don't match schema", async () => {
await expect(validate('?group')).rejects.toThrowError();
});
});
+1 -1
View File
@@ -23,7 +23,7 @@ import { ConfigContextProps } from '../hooks/useConfig';
const schema = yup
.object()
.shape({
group: yup.string(),
group: yup.string().nullable(),
project: yup.string().nullable(),
})
.required();