@@ -79,9 +79,11 @@ vi.mock('@/stores/firebaseAuthStore', () => ({
7979} ) )
8080
8181// Mock the useSubscription composable
82+ const mockFetchStatus = vi . fn ( ) . mockResolvedValue ( undefined )
8283vi . mock ( '@/platform/cloud/subscription/composables/useSubscription' , ( ) => ( {
8384 useSubscription : vi . fn ( ( ) => ( {
84- isActiveSubscription : vi . fn ( ) . mockReturnValue ( true )
85+ isActiveSubscription : { value : true } ,
86+ fetchStatus : mockFetchStatus
8587 } ) )
8688} ) )
8789
@@ -105,6 +107,15 @@ vi.mock('@/components/common/UserCredit.vue', () => ({
105107 }
106108} ) )
107109
110+ vi . mock ( '@/platform/cloud/subscription/components/SubscribeButton.vue' , ( ) => ( {
111+ default : {
112+ name : 'SubscribeButtonMock' ,
113+ render ( ) {
114+ return h ( 'div' , 'Subscribe Button' )
115+ }
116+ }
117+ } ) )
118+
108119describe ( 'CurrentUserPopover' , ( ) => {
109120 beforeEach ( ( ) => {
110121 vi . clearAllMocks ( )
@@ -137,9 +148,9 @@ describe('CurrentUserPopover', () => {
137148 it ( 'renders logout button with correct props' , ( ) => {
138149 const wrapper = mountComponent ( )
139150
140- // Find all buttons and get the logout button (second one )
151+ // Find all buttons and get the logout button (last button )
141152 const buttons = wrapper . findAllComponents ( Button )
142- const logoutButton = buttons [ 1 ]
153+ const logoutButton = buttons [ 4 ]
143154
144155 // Check that logout button has correct props
145156 expect ( logoutButton . props ( 'label' ) ) . toBe ( 'Log Out' )
@@ -149,9 +160,9 @@ describe('CurrentUserPopover', () => {
149160 it ( 'opens user settings and emits close event when settings button is clicked' , async ( ) => {
150161 const wrapper = mountComponent ( )
151162
152- // Find all buttons and get the settings button (first one )
163+ // Find all buttons and get the settings button (third button )
153164 const buttons = wrapper . findAllComponents ( Button )
154- const settingsButton = buttons [ 0 ]
165+ const settingsButton = buttons [ 2 ]
155166
156167 // Click the settings button
157168 await settingsButton . trigger ( 'click' )
@@ -167,9 +178,9 @@ describe('CurrentUserPopover', () => {
167178 it ( 'calls logout function and emits close event when logout button is clicked' , async ( ) => {
168179 const wrapper = mountComponent ( )
169180
170- // Find all buttons and get the logout button (second one )
181+ // Find all buttons and get the logout button (last button )
171182 const buttons = wrapper . findAllComponents ( Button )
172- const logoutButton = buttons [ 1 ]
183+ const logoutButton = buttons [ 4 ]
173184
174185 // Click the logout button
175186 await logoutButton . trigger ( 'click' )
@@ -185,16 +196,16 @@ describe('CurrentUserPopover', () => {
185196 it ( 'opens API pricing docs and emits close event when API pricing button is clicked' , async ( ) => {
186197 const wrapper = mountComponent ( )
187198
188- // Find all buttons and get the API pricing button (third one now )
199+ // Find all buttons and get the Partner Nodes info button (first one)
189200 const buttons = wrapper . findAllComponents ( Button )
190- const apiPricingButton = buttons [ 2 ]
201+ const partnerNodesButton = buttons [ 0 ]
191202
192- // Click the API pricing button
193- await apiPricingButton . trigger ( 'click' )
203+ // Click the Partner Nodes button
204+ await partnerNodesButton . trigger ( 'click' )
194205
195206 // Verify window.open was called with the correct URL
196207 expect ( window . open ) . toHaveBeenCalledWith (
197- 'https://docs.comfy.org/tutorials/api-nodes/pricing ' ,
208+ 'https://docs.comfy.org/tutorials/api-nodes/overview#api-nodes ' ,
198209 '_blank'
199210 )
200211
@@ -206,9 +217,9 @@ describe('CurrentUserPopover', () => {
206217 it ( 'opens top-up dialog and emits close event when top-up button is clicked' , async ( ) => {
207218 const wrapper = mountComponent ( )
208219
209- // Find all buttons and get the top-up button (last one)
220+ // Find all buttons and get the top-up button (second one)
210221 const buttons = wrapper . findAllComponents ( Button )
211- const topUpButton = buttons [ buttons . length - 1 ]
222+ const topUpButton = buttons [ 1 ]
212223
213224 // Click the top-up button
214225 await topUpButton . trigger ( 'click' )
0 commit comments