Skip to content

Commit

Permalink
move proofGenerationDelay to const in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-basiuk committed Jul 10, 2023
1 parent 5e3ac15 commit 1cd5748
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ var stateResolvers = map[string]pubsignals.StateResolver{
"polygon:mumbai": &mockStateResolver{},
}

const proofGenerationDelay = time.Hour * 100000

type mockStateResolver struct {
}

Expand Down Expand Up @@ -614,7 +616,7 @@ func TestVerifyMessageWithMTPProof_Merkalized(t *testing.T) {
schemaLoader := &mockJSONLDSchemaLoader{schema: kycV3Schema}
authInstance, err := NewVerifierWithExplicitError(verificationKeyloader, schemaLoader, stateResolvers)
require.NoError(t, err)
err = authInstance.VerifyAuthResponse(context.Background(), message, request, pubsignals.WithAcceptedProofGenerationDelay(time.Hour*100000))
err = authInstance.VerifyAuthResponse(context.Background(), message, request, pubsignals.WithAcceptedProofGenerationDelay(proofGenerationDelay))
require.NoError(t, err)
}

Expand Down Expand Up @@ -666,7 +668,7 @@ func TestVerifier_FullVerify(t *testing.T) {
schemaLoader := &mockJSONLDSchemaLoader{schema: kycV3Schema}
authInstance, err := NewVerifierWithExplicitError(verificationKeyloader, schemaLoader, stateResolvers)
require.NoError(t, err)
_, err = authInstance.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(time.Hour*100000))
_, err = authInstance.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(proofGenerationDelay))
require.NoError(t, err)
}

Expand Down Expand Up @@ -703,7 +705,7 @@ func TestVerifier_FullVerify_JWS(t *testing.T) {
err = pm.RegisterPackers(jwsPacker)
require.NoError(t, err)
v.SetPackageManager(pm)
_, err = v.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(time.Hour*100000))
_, err = v.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(proofGenerationDelay))
require.NoError(t, err)
}

Expand Down Expand Up @@ -922,7 +924,7 @@ func TestVerifier_FullVerifySelectiveDisclosure(t *testing.T) {
schemaLoader := &mockJSONLDSchemaLoader{schema: kycV4Schema}
authInstance, err := NewVerifierWithExplicitError(verificationKeyloader, schemaLoader, stateResolvers)
require.NoError(t, err)
_, err = authInstance.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(time.Hour*100000))
_, err = authInstance.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(proofGenerationDelay))
require.NoError(t, err)
}

Expand Down Expand Up @@ -952,6 +954,6 @@ func TestEmptyCredentialSubject(t *testing.T) {
schemaLoader := &mockJSONLDSchemaLoader{schema: kycV101Schema}
authInstance, err := NewVerifierWithExplicitError(verificationKeyloader, schemaLoader, stateResolvers)
require.NoError(t, err)
_, err = authInstance.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(time.Hour*100000))
_, err = authInstance.FullVerify(context.Background(), token, request, pubsignals.WithAcceptedProofGenerationDelay(proofGenerationDelay))
require.NoError(t, err)
}

0 comments on commit 1cd5748

Please sign in to comment.