Merge pull request #5801 from backstage/cost-insights-null-group-bugfix
fix(cost-insights): null groups in urls
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user