Skip to content

Commit

Permalink
fixed expected data in test with unique group
Browse files Browse the repository at this point in the history
  • Loading branch information
Ptroger committed Oct 30, 2024
1 parent 5569c58 commit ab102f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,10 @@ describe('OpenPolicyAgentEngine', () => {
credentials: [],
tokens: [],
userGroupMembers: [],
userGroups: [],
groups: [],
userAccounts: [],
users: [],
accountGroupMembers: [],
accountGroups: [],
accounts: []
})
})
Expand Down Expand Up @@ -440,7 +439,7 @@ describe('OpenPolicyAgentEngine', () => {
],
tokens: [],
userGroupMembers: [],
userGroups: [],
groups: [],
userAccounts: [],
users: [
{
Expand All @@ -449,7 +448,6 @@ describe('OpenPolicyAgentEngine', () => {
}
],
accountGroupMembers: [],
accountGroups: [],
accounts: [
{
id: 'eip155:eoa:0x0301e2724a40E934Cce3345928b88956901aA127',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ACCOUNT, ACCOUNT_GROUP, ADDRESS_BOOK, CREDENTIAL, TOKEN, USER, USER_GROUP } from '../../../dev.fixture'
import { ACCOUNT, ADDRESS_BOOK, CREDENTIAL, GROUP, TOKEN, USER } from '../../../dev.fixture'
import { Entities, UserEntity, UserRole } from '../../../type/entity.type'
import { empty, updateUserAccounts, validate } from '../../entity.util'

Expand All @@ -8,11 +8,10 @@ describe('validate', () => {
credentials: [],
tokens: [],
userGroupMembers: [],
userGroups: [],
userAccounts: [],
users: [],
accountGroupMembers: [],
accountGroups: [],
groups: [],
accounts: []
}

Expand All @@ -22,7 +21,7 @@ describe('validate', () => {
...emptyEntities,
userGroupMembers: [
{
groupId: USER_GROUP.Engineering.id,
groupId: GROUP.Engineering.id,
userId: USER.Alice.id
}
],
Expand All @@ -44,10 +43,10 @@ describe('validate', () => {
it('fails when user from user group member does not exist', () => {
const result = validate({
...emptyEntities,
userGroups: [USER_GROUP.Engineering],
groups: [GROUP.Engineering],
userGroupMembers: [
{
groupId: USER_GROUP.Engineering.id,
groupId: GROUP.Engineering.id,
userId: USER.Alice.id
}
]
Expand All @@ -72,7 +71,7 @@ describe('validate', () => {
accountGroupMembers: [
{
accountId: ACCOUNT.Engineering.id,
groupId: ACCOUNT_GROUP.Engineering.id
groupId: GROUP.Engineering.id
}
]
})
Expand All @@ -92,11 +91,11 @@ describe('validate', () => {
it('fails when account from account group member does not exist', () => {
const result = validate({
...emptyEntities,
accountGroups: [ACCOUNT_GROUP.Engineering],
groups: [GROUP.Engineering],
accountGroupMembers: [
{
accountId: ACCOUNT.Engineering.id,
groupId: ACCOUNT_GROUP.Engineering.id
groupId: GROUP.Engineering.id
}
]
})
Expand Down Expand Up @@ -215,15 +214,15 @@ describe('validate', () => {
it('fails when user group uids are not unique', () => {
const result = validate({
...emptyEntities,
userGroups: [USER_GROUP.Engineering, USER_GROUP.Engineering, USER_GROUP.Treasury]
groups: [GROUP.Engineering, GROUP.Engineering, GROUP.Treasury]
})

expect(result).toEqual({
success: false,
issues: [
{
code: 'UNIQUE_IDENTIFIER_DUPLICATION',
message: `the user group ${USER_GROUP.Engineering.id} is duplicated`
message: `the user group ${GROUP.Engineering.id} is duplicated`
}
]
})
Expand All @@ -249,15 +248,15 @@ describe('validate', () => {
it('fails when account group uids are not unique', () => {
const result = validate({
...emptyEntities,
accountGroups: [ACCOUNT_GROUP.Engineering, ACCOUNT_GROUP.Engineering, ACCOUNT_GROUP.Treasury]
groups: [GROUP.Engineering, GROUP.Engineering, GROUP.Treasury]
})

expect(result).toEqual({
success: false,
issues: [
{
code: 'UNIQUE_IDENTIFIER_DUPLICATION',
message: `the account group ${ACCOUNT_GROUP.Engineering.id} is duplicated`
message: `the account group ${GROUP.Engineering.id} is duplicated`
}
]
})
Expand Down

0 comments on commit ab102f9

Please sign in to comment.