Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api-sdk); add create associated group #590

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
test(api): update test to include group type
waddaboo committed Oct 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 90445fcac9098a812aacf5fa682536a81afba9aa
9 changes: 9 additions & 0 deletions apps/api/src/app/credentials/credentials.service.test.ts
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ import { InvitesService } from "../invites/invites.service"
import { OAuthAccount } from "./entities/credentials-account.entity"
import { CredentialsService } from "./credentials.service"
import { AdminsModule } from "../admins/admins.module"
import { GroupType } from "../groups/types"

jest.mock("@bandada/utils", () => {
const originalModule = jest.requireActual("@bandada/utils")
@@ -83,6 +84,7 @@ describe("CredentialsService", () => {
{
name: "Group1",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -104,6 +106,7 @@ describe("CredentialsService", () => {
{
name: "Group2",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -186,6 +189,7 @@ describe("CredentialsService", () => {
{
name: "Group2",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -232,6 +236,7 @@ describe("CredentialsService", () => {
{
name: "Group2",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -337,6 +342,7 @@ describe("CredentialsService", () => {
{
name: "Group2",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -387,6 +393,7 @@ describe("CredentialsService", () => {
{
name: "Group3",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -439,6 +446,7 @@ describe("CredentialsService", () => {
{
name: "Group4",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -492,6 +500,7 @@ describe("CredentialsService", () => {
{
name: "Group5",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
54 changes: 45 additions & 9 deletions apps/api/src/app/groups/groups.service.test.ts
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ import { AdminsModule } from "../admins/admins.module"
import { Admin } from "../admins/entities/admin.entity"
import { CreateGroupDto } from "./dto/create-group.dto"
import { UpdateGroupDto } from "./dto/update-group.dto"
import { GroupType } from "./types"

jest.mock("@bandada/utils", () => {
const originalModule = jest.requireActual("@bandada/utils")
@@ -66,6 +67,7 @@ describe("GroupsService", () => {
{
name: "Group1",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -77,16 +79,19 @@ describe("GroupsService", () => {

describe("# createGroup", () => {
it("Should create a group", async () => {
const { treeDepth, members } = await groupsService.createGroup(
{
name: "Group2",
description: "This is a description",
treeDepth: 16,
fingerprintDuration: 3600
},
"admin"
)
const { type, treeDepth, members } =
await groupsService.createGroup(
{
name: "Group2",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
"admin"
)

expect(type).toBe(GroupType.OFFCHAIN)
expect(treeDepth).toBe(16)
expect(members).toHaveLength(0)
})
@@ -98,6 +103,7 @@ describe("GroupsService", () => {
{
name: "Group3",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -126,6 +132,7 @@ describe("GroupsService", () => {
{
name: "Group4",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600,
credentials: {
@@ -200,6 +207,7 @@ describe("GroupsService", () => {
{
name: "Group01",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -211,6 +219,7 @@ describe("GroupsService", () => {
{
name: "Group02",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -229,6 +238,7 @@ describe("GroupsService", () => {
{
name: "MemberGroup",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -319,6 +329,7 @@ describe("GroupsService", () => {
{
name: "MemberGroup",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -382,6 +393,7 @@ describe("GroupsService", () => {
{
name: "Group2",
description: "This is a new group",
type: GroupType.OFFCHAIN,
treeDepth: 21,
fingerprintDuration: 3600
},
@@ -426,6 +438,7 @@ describe("GroupsService", () => {
{
name: "Group2",
description: "This is a new group",
type: GroupType.OFFCHAIN,
treeDepth: 21,
fingerprintDuration: 3600
},
@@ -455,6 +468,7 @@ describe("GroupsService", () => {
const groupDto: CreateGroupDto = {
name: "Group",
description: "This is a new group",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
}
@@ -611,20 +625,23 @@ describe("GroupsService", () => {
id: "1",
name: "Group1",
description: "This is a new group1",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
{
id: "2",
name: "Group2",
description: "This is a new group2",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
{
id: "3",
name: "Group3",
description: "This is a new group3",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
}
@@ -785,6 +802,7 @@ describe("GroupsService", () => {
id: "1",
name: "Group1",
description: "This is a new group1",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
}
@@ -888,13 +906,15 @@ describe("GroupsService", () => {
id: "1",
name: "Group1",
description: "This is a new group1",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
{
id: "2",
name: "Group2",
description: "This is a new group2",
type: GroupType.OFFCHAIN,
treeDepth: 32,
fingerprintDuration: 7200
}
@@ -1028,6 +1048,7 @@ describe("GroupsService", () => {
{
name: "Group2",
description: "This is a new group",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -1178,6 +1199,7 @@ describe("GroupsService", () => {
{
name: "Group2",
description: "This is a new group",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -1202,6 +1224,7 @@ describe("GroupsService", () => {
{
name: "Credential Group",
description: "This is a new group",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600,
credentials: {
@@ -1350,6 +1373,7 @@ describe("GroupsService", () => {
{
name: "Group2",
description: "This is a new group",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -1398,6 +1422,7 @@ describe("GroupsService", () => {
{
name: "Group2",
description: "This is a new group",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -1425,6 +1450,7 @@ describe("GroupsService", () => {
{
name: "Credential Group",
description: "This is a new group",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600,
credentials: {
@@ -1476,6 +1502,7 @@ describe("GroupsService", () => {
id: "1",
name: "Group1",
description: "This is a new group1",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
}
@@ -1518,13 +1545,15 @@ describe("GroupsService", () => {
id: "1",
name: "Group1",
description: "This is a new group1",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
{
id: "2",
name: "Group2",
description: "This is a new group2",
type: GroupType.OFFCHAIN,
treeDepth: 32,
fingerprintDuration: 7200
}
@@ -1571,6 +1600,7 @@ describe("GroupsService", () => {
id: "1",
name: "Group1",
description: "This is a new group1",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
}
@@ -1623,13 +1653,15 @@ describe("GroupsService", () => {
id: "1",
name: "Group1",
description: "This is a new group1",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
{
id: "2",
name: "Group2",
description: "This is a new group2",
type: GroupType.OFFCHAIN,
treeDepth: 32,
fingerprintDuration: 7200
}
@@ -1706,6 +1738,7 @@ describe("GroupsService", () => {
id: "1",
name: "Group1",
description: "This is a new group1",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
}
@@ -1778,13 +1811,15 @@ describe("GroupsService", () => {
id: "1",
name: "Group1",
description: "This is a new group1",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
{
id: "2",
name: "Group2",
description: "This is a new group2",
type: GroupType.OFFCHAIN,
treeDepth: 32,
fingerprintDuration: 7200
}
@@ -1879,6 +1914,7 @@ describe("GroupsService", () => {
{
name: "Fingerprint Group",
description: "This is a description",
type: GroupType.OFFCHAIN,
treeDepth: 16,
fingerprintDuration: 3600
},
Loading