Differential D350 Diff 1244 lib/app/base-chips/special_filters/IsReferencedByResourcesMatching.subtest.js
Changeset View
Changeset View
Standalone View
Standalone View
lib/app/base-chips/special_filters/IsReferencedByResourcesMatching.subtest.js
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | const created_users = await Promise.map(users, user => | ||||
}) | }) | ||||
); | ); | ||||
await Promise.map(created_users, user => | await Promise.map(created_users, user => | ||||
create_resource_as({ | create_resource_as({ | ||||
collection: "users-roles", | collection: "users-roles", | ||||
resource: { | resource: { | ||||
user: user.id, | user: user.id, | ||||
role: user.body.username, | role: user.username, | ||||
}, | }, | ||||
port, | port, | ||||
}) | }) | ||||
); | ); | ||||
} | } | ||||
it("returns only users with role matching `allowed_values`", () => | it("returns only users with role matching `allowed_values`", () => | ||||
with_running_app(async ({ app, rest_api }) => { | with_running_app(async ({ app, rest_api }) => { | ||||
await setup(app); | await setup(app); | ||||
return rest_api | return rest_api | ||||
.get("/api/v1/collections/users/@staff") | .get("/api/v1/collections/users/@staff") | ||||
.then(({ items }) => { | .then(({ items }) => { | ||||
assert(items.length > 0); | assert(items.length > 0); | ||||
items.forEach(user => | items.forEach(user => | ||||
assert( | assert( | ||||
user.body.username === "admin" || | user.username === "admin" || | ||||
user.body.username === "moderator" | user.username === "moderator" | ||||
) | ) | ||||
); | ); | ||||
}); | }); | ||||
})); | })); | ||||
}); | }); |