Skip to content

Conversation

adecaro
Copy link
Contributor

@adecaro adecaro commented Apr 14, 2025

No description provided.

@adecaro adecaro self-assigned this Apr 14, 2025
@adecaro adecaro force-pushed the f-933-token branch 2 times, most recently from df79064 to 2ff7bb6 Compare April 17, 2025 13:54
@adecaro adecaro force-pushed the f-933-token branch 2 times, most recently from d2fbba9 to e989579 Compare July 1, 2025 06:11
{
name: "publicParams cannot be nil",
init: func() (logging.Logger, *setup.PublicParams, token2.IdentityDeserializer, error) {
return nil, nil, nil, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to return the logger? we could use some default or nil value always, or are we testing something?

Copy link
Contributor

@alexandrosfilios alexandrosfilios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo comments

},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that using matrices here makes the tests more complex. The amount of re-usable code is negligible, so I would inline the tests, e.g.

func Test_Success(t *testing.T) {
				RegisterTestingT(t)
				id := &mock.IdentityDeserializer{}
				id.RecipientsReturns([]driver.Identity{driver.Identity("alice")}, nil)
				ts, err := token2.NewTokensService(nil, pp, id)
				Expect(err).ToNot(HaveOccurred())

				tok := &token2.Token{}
				raw, err := tok.Serialize()
				Expect(err).ToNot(HaveOccurred())

				identities, err := ts.Recipients(raw)
				Expect(err).ToNot(HaveOccurred())
				Expect(identities).To(ConsistOf(driver.Identity("Alice"))
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way also your errors can become more descriptive, e.g.

Expect(err).To(ContainSubstring(...))

adecaro and others added 15 commits July 27, 2025 06:51
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
@adecaro adecaro added this to the Q3 milestone Jul 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants