feat: add tests for webhook resolvers

This commit is contained in:
Lakhan Samani
2022-07-11 19:40:54 +05:30
parent 334041d0e4
commit 018a13ab3c
24 changed files with 381 additions and 31 deletions

View File

@@ -21,8 +21,10 @@ import (
// common user data to share across tests
type TestData struct {
Email string
Password string
Email string
Password string
WebhookEndpoint string
TestEventTypes []string
}
type TestSetup struct {
@@ -75,8 +77,10 @@ func createContext(s TestSetup) (*http.Request, context.Context) {
func testSetup() TestSetup {
testData := TestData{
Email: fmt.Sprintf("%d_authorizer_tester@yopmail.com", time.Now().Unix()),
Password: "Test@123",
Email: fmt.Sprintf("%d_authorizer_tester@yopmail.com", time.Now().Unix()),
Password: "Test@123",
WebhookEndpoint: "https://62cbc6738042b16aa7c22df2.mockapi.io/api/v1/webhook",
TestEventTypes: []string{constants.UserAccessEnabledWebhookEvent, constants.UserAccessRevokedWebhookEvent, constants.UserCreatedWebhookEvent, constants.UserDeletedWebhookEvent, constants.UserLoginWebhookEvent, constants.UserSignUpWebhookEvent},
}
err := os.Setenv(constants.EnvKeyEnvPath, "../../.env.test")