@@ -16,6 +16,7 @@ vi.mock("@ui/components/AuthContext", async () => {
1616
1717describe ( "StripeCurrentLinksPanel Tests" , ( ) => {
1818 const getLinksMock = vi . fn ( ) ;
19+ const deactivateLinkMock = vi . fn ( ) ;
1920
2021 const renderComponent = async ( ) => {
2122 await act ( async ( ) => {
@@ -26,7 +27,10 @@ describe("StripeCurrentLinksPanel Tests", () => {
2627 withCssVariables
2728 forceColorScheme = "light"
2829 >
29- < StripeCurrentLinksPanel getLinks = { getLinksMock } />
30+ < StripeCurrentLinksPanel
31+ getLinks = { getLinksMock }
32+ deactivateLink = { deactivateLinkMock }
33+ />
3034 </ MantineProvider >
3135 </ MemoryRouter > ,
3236 ) ;
@@ -154,7 +158,7 @@ describe("StripeCurrentLinksPanel Tests", () => {
154158 it ( "triggers deactivation when clicking deactivate button" , async ( ) => {
155159 getLinksMock . mockResolvedValue ( [
156160 {
157- id : "1 " ,
161+ id : "abc123 " ,
158162 active : true ,
159163 invoiceId : "INV-001" ,
160164 invoiceAmountUsd : 5000 ,
@@ -163,7 +167,6 @@ describe("StripeCurrentLinksPanel Tests", () => {
163167 link : "http://example.com" ,
164168 } ,
165169 ] ) ;
166- const notificationsMock = vi . spyOn ( notifications , "show" ) ;
167170 await renderComponent ( ) ;
168171
169172 const checkbox = screen . getByLabelText ( "Select row" ) ;
@@ -172,14 +175,6 @@ describe("StripeCurrentLinksPanel Tests", () => {
172175 const deactivateButton = await screen . findByText ( / D e a c t i v a t e 1 l i n k / ) ;
173176 await userEvent . click ( deactivateButton ) ;
174177
175- expect ( notificationsMock ) . toHaveBeenCalledWith (
176- expect . objectContaining ( {
177- title : "Feature not available" ,
178- message : "Coming soon!" ,
179- color : "yellow" ,
180- } ) ,
181- ) ;
182-
183- notificationsMock . mockRestore ( ) ;
178+ expect ( deactivateLinkMock ) . toHaveBeenCalledWith ( "abc123" ) ;
184179 } ) ;
185180} ) ;
0 commit comments