1- /* global jest */
1+ import { describe , it , expect , vi } from "vitest" ;
22import { ApiClient } from "../../src/common/atlas/apiClient.js" ;
33import { ensureCurrentIpInAccessList } from "../../src/common/atlas/accessListUtils.js" ;
4- import { jest } from "@jest/globals" ;
54import { ApiClientError } from "../../src/common/atlas/apiClientError.js" ;
65
76describe ( "accessListUtils" , ( ) => {
87 it ( "should add the current IP to the access list" , async ( ) => {
98 const apiClient = {
10- getIpInfo : jest . fn ( ) . mockResolvedValue ( { currentIpv4Address : "127.0.0.1" } as never ) ,
11- createProjectIpAccessList : jest . fn ( ) . mockResolvedValue ( undefined as never ) ,
9+ getIpInfo : vi . fn ( ) . mockResolvedValue ( { currentIpv4Address : "127.0.0.1" } as never ) ,
10+ createProjectIpAccessList : vi . fn ( ) . mockResolvedValue ( undefined as never ) ,
1211 } as unknown as ApiClient ;
1312 await ensureCurrentIpInAccessList ( apiClient , "projectId" ) ;
1413 expect ( apiClient . createProjectIpAccessList ) . toHaveBeenCalledWith ( {
@@ -21,8 +20,8 @@ describe("accessListUtils", () => {
2120
2221 it ( "should not fail if the current IP is already in the access list" , async ( ) => {
2322 const apiClient = {
24- getIpInfo : jest . fn ( ) . mockResolvedValue ( { currentIpv4Address : "127.0.0.1" } as never ) ,
25- createProjectIpAccessList : jest
23+ getIpInfo : vi . fn ( ) . mockResolvedValue ( { currentIpv4Address : "127.0.0.1" } as never ) ,
24+ createProjectIpAccessList : vi
2625 . fn ( )
2726 . mockRejectedValue (
2827 ApiClientError . fromError (
0 commit comments