catalog-react: never match null in entity predicates

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2025-03-05 23:52:48 +01:00
parent 2b48ac655e
commit 7dfad8f3a2
2 changed files with 5 additions and 0 deletions
@@ -108,6 +108,7 @@ describe('evaluateEntityPredicate', () => {
type: 'grpc',
owner: 'g',
definition: 'mock',
nothing: null,
},
relations: [
{
@@ -215,6 +216,7 @@ describe('evaluateEntityPredicate', () => {
['s,w,a', { 'spec.owner': { $exists: true } }],
['g', { 'spec.owner': { $exists: false } }],
['s', { 'spec.type': 'service' }],
['', { 'spec.nothing': null }],
['w,g,a', { $not: { 'spec.type': 'service' } }],
['', { 'spec.type': null }],
[
@@ -108,6 +108,9 @@ function valuesAreEqual(
a: JsonValue | undefined,
b: JsonValue | undefined,
): boolean {
if (a === null || b === null) {
return false;
}
if (a === b) {
return true;
}