Skip to content

Commit 5a2b95a

Browse files
committed
chore: update unit tests
1 parent d499dad commit 5a2b95a

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

examples/resources/supabase_settings/resource.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ resource "supabase_settings" "production" {
1919
})
2020

2121
auth = jsonencode({
22-
site_url = "http://localhost:3000"
22+
site_url = "http://localhost:3000"
23+
mailer_otp_exp = 3600
24+
mfa_phone_otp_length = 6
25+
sms_otp_length = 6
2326
})
2427
}

internal/provider/pooler_data_source_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ func TestAccPoolerDataSource(t *testing.T) {
1818
// Setup mock api
1919
defer gock.OffAll()
2020
gock.New("https://api.supabase.com").
21-
Get("/v1/projects/mayuaycdtijbctgqbycg/config/database/pgbouncer").
21+
Get("/v1/projects/mayuaycdtijbctgqbycg/config/database/pooler").
2222
Times(3).
2323
Reply(http.StatusOK).
24-
JSON(api.V1PgbouncerConfigResponse{
25-
ConnectionString: &poolerUrl,
26-
DefaultPoolSize: Ptr(float32(15)),
27-
IgnoreStartupParameters: Ptr(""),
28-
MaxClientConn: Ptr(float32(200)),
29-
PoolMode: Ptr(api.Transaction),
30-
})
24+
JSON([]api.SupavisorConfigResponse{{
25+
DatabaseType: api.PRIMARY,
26+
ConnectionString: poolerUrl,
27+
DefaultPoolSize: Ptr(float32(15)),
28+
MaxClientConn: Ptr(float32(200)),
29+
PoolMode: api.SupavisorConfigResponsePoolModeTransaction,
30+
}})
3131
// Run test
3232
resource.Test(t, resource.TestCase{
3333
PreCheck: func() { testAccPreCheck(t) },

internal/provider/settings_resource_test.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,19 @@ func TestAccSettingsResource(t *testing.T) {
6767
Get("/v1/projects/mayuaycdtijbctgqbycg/config/auth").
6868
Reply(http.StatusOK).
6969
JSON(api.AuthConfigResponse{
70-
SiteUrl: Ptr("http://localhost:3000"),
70+
SiteUrl: Ptr("http://localhost:3000"),
71+
MailerOtpExp: 3600,
72+
MfaPhoneOtpLength: 6,
73+
SmsOtpLength: 6,
7174
})
7275
gock.New("https://api.supabase.com").
7376
Patch("/v1/projects/mayuaycdtijbctgqbycg/config/auth").
7477
Reply(http.StatusOK).
7578
JSON(api.AuthConfigResponse{
76-
SiteUrl: Ptr("http://localhost:3000"),
79+
SiteUrl: Ptr("http://localhost:3000"),
80+
MailerOtpExp: 3600,
81+
MfaPhoneOtpLength: 6,
82+
SmsOtpLength: 6,
7783
})
7884
// Step 2: read
7985
gock.New("https://api.supabase.com").
@@ -126,13 +132,19 @@ func TestAccSettingsResource(t *testing.T) {
126132
Get("/v1/projects/mayuaycdtijbctgqbycg/config/auth").
127133
Reply(http.StatusOK).
128134
JSON(api.AuthConfigResponse{
129-
SiteUrl: Ptr("http://localhost:3000"),
135+
SiteUrl: Ptr("http://localhost:3000"),
136+
MailerOtpExp: 3600,
137+
MfaPhoneOtpLength: 6,
138+
SmsOtpLength: 6,
130139
})
131140
gock.New("https://api.supabase.com").
132141
Get("/v1/projects/mayuaycdtijbctgqbycg/config/auth").
133142
Reply(http.StatusOK).
134143
JSON(api.AuthConfigResponse{
135-
SiteUrl: Ptr("http://localhost:3000"),
144+
SiteUrl: Ptr("http://localhost:3000"),
145+
MailerOtpExp: 3600,
146+
MfaPhoneOtpLength: 6,
147+
SmsOtpLength: 6,
136148
})
137149
// Step 3: update
138150
gock.New("https://api.supabase.com").

0 commit comments

Comments
 (0)