prettier...
Signed-off-by: Brian Phillips <28457+brianphillips@users.noreply.github.com>
This commit is contained in:
@@ -135,11 +135,11 @@ describe('isComponentType', () => {
|
||||
|
||||
describe('isEntityWith', () => {
|
||||
it('allows for a kind-only check (empty type array)', () => {
|
||||
const checkEntity = isEntityWith({kind: 'api', type: []});
|
||||
const checkEntity = isEntityWith({ kind: 'api', type: [] });
|
||||
expect(checkEntity(apiKind)).toBeTruthy();
|
||||
});
|
||||
it('handles missing spec.type field', () => {
|
||||
const checkEntity = isEntityWith({kind: 'another-type', type: 'service'});
|
||||
const checkEntity = isEntityWith({ kind: 'another-type', type: 'service' });
|
||||
expect(checkEntity(missingSpecType)).not.toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ function strCmpAll(value: string | undefined, cmpValues: string | string[]) {
|
||||
* @public
|
||||
*/
|
||||
export function isKind(kinds: string | string[]) {
|
||||
return isEntityWith({kind: kinds});
|
||||
return isEntityWith({ kind: kinds });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,10 @@ export function isEntityWith(predicate: EntityPredicates) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!predicate.type || (Array.isArray(predicate.type) && predicate.type.length === 0)) {
|
||||
if (
|
||||
!predicate.type ||
|
||||
(Array.isArray(predicate.type) && predicate.type.length === 0)
|
||||
) {
|
||||
// there's no type check, return true
|
||||
return true;
|
||||
} else if (typeof entity.spec?.type !== 'string') {
|
||||
@@ -80,7 +83,6 @@ export function isEntityWith(predicate: EntityPredicates) {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For use in EntitySwitch.Case. Matches if the entity is in a given namespace.
|
||||
* @public
|
||||
|
||||
Reference in New Issue
Block a user