Skip to content

Commit 41ee38e

Browse files
committed
Add test.
1 parent 17f32bc commit 41ee38e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/test/domain/securityPolicyTests.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,3 +1223,27 @@ test("restrict:nodesAndSources", (t) => {
12231223
}
12241224
);
12251225
});
1226+
1227+
test("restrict:nodesAndSources:wild", (t) => {
1228+
const policy = SecurityPolicy.fromJsonObject({
1229+
nodeIds: [1, 2, 3],
1230+
sourceIds: ["/s1/**", "/s2/*"],
1231+
})!;
1232+
1233+
t.deepEqual(
1234+
policy.restrict({
1235+
nodeIds: new Set([2, 3, 4, 5, 6]),
1236+
sourceIds: new Set([
1237+
"/s1/**",
1238+
"/s1/*/*/*",
1239+
"/s2/a",
1240+
"/s2/a/b",
1241+
"/s3/a",
1242+
]),
1243+
}),
1244+
{
1245+
nodeIds: new Set([2, 3]),
1246+
sourceIds: new Set(["/s1/**", "/s1/*/*/*", "/s2/a"]),
1247+
}
1248+
);
1249+
});

0 commit comments

Comments
 (0)