Add test related to creating group with sample attributes - #40558
Merged
edewit merged 5 commits intoAug 12, 2026
Merged
Conversation
Signed-off-by: shuji-oh <syuji0116@gmail.com>
shuji-oh
force-pushed
the
16947-add_example_creating_group_with_attributes
branch
from
June 17, 2025 22:55
645bed6 to
ef9cfaf
Compare
edewit
approved these changes
Jul 23, 2026
edewit
enabled auto-merge (squash)
July 23, 2026 08:43
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
js/libs/keycloak-admin-client/test/groups.spec.ts:50
- The assertion only verifies the existing create API behavior and does not prove that
attributeswere serialized and persisted. Fetch the created group and assert both attribute arrays so a regression that silently drops attributes fails this test.
expect(group.id).to.be.ok;
js/libs/keycloak-admin-client/test/groups.spec.ts:49
- This new top-level group is never removed: the suite teardown only deletes
currentGroup, sobasic-groupremains in the shared realm and can affect later suites. Retain this group's ID and delete it in theafterhook as well.
const group = await kcAdminClient.groups.create({
name: "basic-group",
attributes: {
accessLevel: ["internal"],
project: ["alpha"],
},
});
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
js/libs/keycloak-admin-client/test/groups.spec.ts:49
- The new
basic-groupis never deleted because the suite'safterhook only removescurrentGroup. This leaks state from the suite and makes repeated or filtered runs susceptible to stale groups and incorrect counts; delete this group after its assertions or track it for cleanup in the hook.
const group = await kcAdminClient.groups.create({
name: "basic-group",
attributes: {
accessLevel: ["internal"],
project: ["alpha"],
},
});
js/libs/keycloak-admin-client/test/groups.spec.ts:50
- This test only verifies that some group was created, so it still passes if the client or server silently drops
attributes. Read the group back by ID and assert that both attribute arrays were persisted.
expect(group.id).to.be.ok;
ruchikajha95
pushed a commit
to ruchikajha95/keycloak
that referenced
this pull request
Aug 12, 2026
…0558) Signed-off-by: shuji-oh <syuji0116@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a test case for creating a group with attributes to illustrate proper usage of the API.
The added test covers a group with sample attributes such as
accessLevelandproject.Closes #16947
Local test results: