Skip to content

Commit acb8fb2

Browse files
committed
test: unify falsy pattern handling in variable matcher
A falsy name, scope, or origin pattern now skips the find filter uniformly, matching the absence assertions downstream; previously only origin had the guard and null name/scope patterns could never match. Related to camunda/camunda-modeler#5985
1 parent defbbbb commit acb8fb2

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

test/assertions.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ const { expect } = require('chai');
22
const { has } = require('min-dash');
33

44

5-
function isDefined(value) {
6-
return typeof value !== 'undefined';
7-
}
8-
95
function findVariable(variables, expectedVariable) {
106
const {
117
name,
@@ -14,9 +10,9 @@ function findVariable(variables, expectedVariable) {
1410
} = expectedVariable;
1511

1612
const variable = variables.find(
17-
v => (!isDefined(name) || v.name === name)
18-
&& (!isDefined(scope) || v.scope?.id === scope)
19-
&& (!isDefined(origin) || !origin || matchesOrigin(v.origin, origin))
13+
v => (!name || v.name === name)
14+
&& (!scope || v.scope?.id === scope)
15+
&& (!origin || matchesOrigin(v.origin, origin))
2016
);
2117

2218
expect(variable, `variable[name=${name}, scope=${scope}]`).to.exist;

0 commit comments

Comments
 (0)