Skip to content

Commit 2bb3723

Browse files
committed
fix: unit tests
1 parent 127ade7 commit 2bb3723

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tests-ui/tests/platform/cloud/onboarding/CloudSubscriptionRedirectView.test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ const createI18nInstance = () =>
6060
locale: 'en',
6161
messages: {
6262
en: {
63+
cloudOnboarding: {
64+
skipToCloudApp: 'Skip to the cloud app'
65+
},
6366
g: {
6467
comfyOrgLogoAlt: 'Comfy org logo'
6568
},
@@ -110,7 +113,7 @@ describe('CloudSubscriptionRedirectView', () => {
110113
})
111114

112115
test('shows subscription copy when subscriptionType is valid', async () => {
113-
const { wrapper } = await mountView({ subscriptionType: 'creator' })
116+
const { wrapper } = await mountView({ tier: 'creator' })
114117

115118
// Should not redirect to home
116119
expect(mockRouterPush).not.toHaveBeenCalledWith('/')
@@ -121,14 +124,22 @@ describe('CloudSubscriptionRedirectView', () => {
121124
// Triggers checkout flow
122125
expect(mockPerformSubscriptionCheckout).toHaveBeenCalledWith(
123126
'creator',
127+
'monthly',
124128
false
125129
)
130+
131+
// Shows loading affordances
132+
expect(wrapper.findComponent({ name: 'ProgressSpinner' }).exists()).toBe(
133+
true
134+
)
135+
const skipLink = wrapper.get('a[href="/"]')
136+
expect(skipLink.text()).toContain('Skip to the cloud app')
126137
})
127138

128139
test('opens billing portal when subscription is already active', async () => {
129140
subscriptionMocks.isActiveSubscription.value = true
130141

131-
await mountView({ subscriptionType: 'creator' })
142+
await mountView({ tier: 'creator' })
132143

133144
expect(mockRouterPush).not.toHaveBeenCalledWith('/')
134145
expect(authActionMocks.accessBillingPortal).toHaveBeenCalledTimes(1)
@@ -137,13 +148,14 @@ describe('CloudSubscriptionRedirectView', () => {
137148

138149
test('uses first value when subscriptionType is an array', async () => {
139150
const { wrapper } = await mountView({
140-
subscriptionType: ['creator', 'pro']
151+
tier: ['creator', 'pro']
141152
})
142153

143154
expect(mockRouterPush).not.toHaveBeenCalledWith('/')
144155
expect(wrapper.text()).toContain('Subscribe to Creator')
145156
expect(mockPerformSubscriptionCheckout).toHaveBeenCalledWith(
146157
'creator',
158+
'monthly',
147159
false
148160
)
149161
})

0 commit comments

Comments
 (0)