# What this PR does Polishing labels ## Which issue(s) this PR fixes https://github.com/grafana/oncall-private/issues/2355 https://github.com/grafana/oncall-private/issues/2305 https://github.com/grafana/oncall-private/issues/2336 ## Checklist - [x] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --------- Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
41 lines
1,019 B
TypeScript
41 lines
1,019 B
TypeScript
import { getIsTooManyLabelsWarningVisible } from './IntegrationLabelsForm.helpers';
|
|
|
|
describe('getIsTooManyLabelsWarningVisible()', () => {
|
|
const CUSTOM_LABEL = { key: { id: 'c', name: 'c' }, value: { id: 'c', name: 'c' } };
|
|
|
|
it('should return false if limit is not exceeded', () => {
|
|
expect(
|
|
getIsTooManyLabelsWarningVisible(
|
|
{
|
|
inheritable: undefined,
|
|
custom: undefined,
|
|
template: null,
|
|
},
|
|
3
|
|
)
|
|
).toBe(false);
|
|
expect(
|
|
getIsTooManyLabelsWarningVisible(
|
|
{
|
|
inheritable: { a: true, b: false },
|
|
custom: [CUSTOM_LABEL, CUSTOM_LABEL],
|
|
template: null,
|
|
},
|
|
3
|
|
)
|
|
).toBe(false);
|
|
});
|
|
|
|
it('should return true if limit is exceeded', () => {
|
|
expect(
|
|
getIsTooManyLabelsWarningVisible(
|
|
{
|
|
inheritable: { a: true, b: true },
|
|
custom: [CUSTOM_LABEL, CUSTOM_LABEL],
|
|
template: null,
|
|
},
|
|
3
|
|
)
|
|
).toBe(true);
|
|
});
|
|
});
|