File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
apps/sim/app/api/copilot/checkpoints/revert Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,13 @@ describe('Copilot Checkpoints Revert API Route', () => {
2323 setupCommonApiMocks ( )
2424 mockCryptoUuid ( )
2525
26+ // Mock getBaseUrl to return localhost for tests
27+ vi . doMock ( '@/lib/urls/utils' , ( ) => ( {
28+ getBaseUrl : vi . fn ( ( ) => 'http://localhost:3000' ) ,
29+ getBaseDomain : vi . fn ( ( ) => 'localhost:3000' ) ,
30+ getEmailDomain : vi . fn ( ( ) => 'localhost:3000' ) ,
31+ } ) )
32+
2633 mockSelect . mockReturnValue ( { from : mockFrom } )
2734 mockFrom . mockReturnValue ( { where : mockWhere } )
2835 mockWhere . mockReturnValue ( { then : mockThen } )
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212} from '@/lib/copilot/auth'
1313import { createLogger } from '@/lib/logs/console/logger'
1414import { validateUUID } from '@/lib/security/input-validation'
15+ import { getBaseUrl } from '@/lib/urls/utils'
1516
1617const logger = createLogger ( 'CheckpointRevertAPI' )
1718
@@ -93,7 +94,7 @@ export async function POST(request: NextRequest) {
9394 }
9495
9596 const stateResponse = await fetch (
96- `${ request . nextUrl . origin } /api/workflows/${ checkpoint . workflowId } /state` ,
97+ `${ getBaseUrl ( ) } /api/workflows/${ checkpoint . workflowId } /state` ,
9798 {
9899 method : 'PUT' ,
99100 headers : {
You can’t perform that action at this time.
0 commit comments