Skip to content

Commit 45c14ec

Browse files
committed
test(backend): add enterpriseAccounts to user fixture and factory test
Add enterprise_accounts with an EnterpriseAccountConnection to the user.json fixture. Assert deserialization in factory.test.ts.
1 parent 5781a63 commit 45c14ec

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

packages/backend/src/api/__tests__/factory.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ describe('api.client', () => {
2929
expect(response.emailAddresses[0].emailAddress).toBe('john.doe@clerk.test');
3030
expect(response.phoneNumbers[0].phoneNumber).toBe('+311-555-2368');
3131
expect(response.externalAccounts[0].emailAddress).toBe('john.doe@clerk.test');
32+
expect(response.enterpriseAccounts[0].emailAddress).toBe('john.doe@clerk.test');
33+
expect(response.enterpriseAccounts[0].provider).toBe('saml_okta');
34+
expect(response.enterpriseAccounts[0].enterpriseConnection?.name).toBe('Okta SSO');
3235
expect(response.publicMetadata.zodiac_sign).toBe('leo');
3336
});
3437

packages/backend/src/fixtures/user.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,44 @@
9191
"updated_at": 1611948436
9292
}
9393
],
94+
"enterprise_accounts": [
95+
{
96+
"object": "enterprise_account",
97+
"id": "ea_okta",
98+
"active": true,
99+
"email_address": "john.doe@clerk.test",
100+
"first_name": "John",
101+
"last_name": "Doe",
102+
"protocol": "saml",
103+
"provider": "saml_okta",
104+
"provider_user_id": "okta_user_123",
105+
"public_metadata": {},
106+
"verification": {
107+
"status": "verified",
108+
"strategy": "saml",
109+
"attempts": null,
110+
"expire_at": 1613831855
111+
},
112+
"last_authenticated_at": 1611948436,
113+
"enterprise_connection_id": "ent_conn_okta",
114+
"enterprise_connection": {
115+
"id": "ent_conn_okta",
116+
"object": "enterprise_account_connection",
117+
"active": true,
118+
"allow_idp_initiated": false,
119+
"allow_subdomains": false,
120+
"disable_additional_identifications": false,
121+
"domain": "clerk.test",
122+
"logo_public_url": null,
123+
"name": "Okta SSO",
124+
"protocol": "saml",
125+
"provider": "saml_okta",
126+
"sync_user_attributes": true,
127+
"created_at": 1611948436,
128+
"updated_at": 1611948436
129+
}
130+
}
131+
],
94132
"saml_accounts": [
95133
{
96134
"object": "saml_account",

0 commit comments

Comments
 (0)