-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updated testing. changed srv to start listenng in new routine a…
…nd return server that can be cancelled
- Loading branch information
Wil Simpson
committed
Dec 5, 2024
1 parent
a591fd0
commit 7d83b63
Showing
3 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package util_test | ||
|
||
import ( | ||
"github.com/WilSimpson/gocloak/v13" | ||
"github.com/go-faker/faker/v4" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
"github.com/ShatteredRealms/go-common-service/pkg/util" | ||
) | ||
|
||
var _ = Describe("Misc", func() { | ||
Describe("RegisterRole", func() { | ||
It("should append the role to the roles slice", func() { | ||
roles := []*gocloak.Role{} | ||
role := &gocloak.Role{} | ||
role2 := &gocloak.Role{} | ||
Expect(faker.FakeData(role)).To(Succeed()) | ||
Expect(faker.FakeData(role2)).To(Succeed()) | ||
Expect(util.RegisterRole(role, &roles)).To(Equal(role)) | ||
Expect(roles).To(ContainElement(role)) | ||
Expect(util.RegisterRole(role2, &roles)).To(Equal(role2)) | ||
Expect(roles).To(ContainElement(role2)) | ||
Expect(roles).To(HaveLen(2)) | ||
}) | ||
}) | ||
}) |