feat(invitations): accept invitations with C4 consent and contact grants; share the E0 quota across holdings
This commit is contained in:
1 parent
a5990d3fc6
commit
676b3c6e24
59 files changed
+4926
-194
No files matched your search
@@ -94,3 +94,28 @@ func TestCandidateInvitationResponseCarriesTheDeclineAndNoCandidateData(t *testi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvitationAcceptFailuresMapToTheContractStatuses(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
text := &domain.InvitationFieldError{Pointer: "/consent_c4/text_version", Reason: "x"}
|
||||
for name, test := range map[string]struct {
|
||||
err error
|
||||
want string
|
||||
}{
|
||||
"employer": {invitationusecase.ErrForbidden, "*api.AcceptMyInvitationForbidden"},
|
||||
"unknown": {fmt.Errorf("wrapped: %w", outbound.ErrInvitationNotFound), "*api.AcceptMyInvitationNotFound"},
|
||||
"reused key": {invitationusecase.ErrIdempotencyKeyReused, "*api.AcceptMyInvitationUnprocessableEntity"},
|
||||
"bad key": {invitationusecase.ErrInvalidIdempotencyKey, "*api.AcceptMyInvitationBadRequest"},
|
||||
"consent text": {fmt.Errorf("wrapped: %w", text), "*api.AcceptMyInvitationBadRequest"},
|
||||
"stale version": {fmt.Errorf("wrapped: %w", domain.ErrInvitationVersionConflict), "*api.AcceptMyInvitationPreconditionFailed"},
|
||||
"terminal or late": {fmt.Errorf("wrapped: %w", invitationusecase.ErrAnswerBlocked), "*api.AcceptMyInvitationConflict"},
|
||||
} {
|
||||
response, unexpected := invitationAcceptFailure(ctx, test.err)
|
||||
if unexpected != nil || fmt.Sprintf("%T", response) != test.want {
|
||||
t.Errorf("%s: failure = %T, %v; want %s", name, response, unexpected, test.want)
|
||||
}
|
||||
}
|
||||
if _, unexpected := invitationAcceptFailure(ctx, errors.New("storage failed")); unexpected == nil {
|
||||
t.Error("an unknown failure produced a public response instead of reaching the responder")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user