1
- /* global jest */
1
+ import { describe , it , expect , vi } from "vitest" ;
2
2
import { ApiClient } from "../../src/common/atlas/apiClient.js" ;
3
3
import { ensureCurrentIpInAccessList } from "../../src/common/atlas/accessListUtils.js" ;
4
- import { jest } from "@jest/globals" ;
5
4
import { ApiClientError } from "../../src/common/atlas/apiClientError.js" ;
6
5
7
6
describe ( "accessListUtils" , ( ) => {
8
7
it ( "should add the current IP to the access list" , async ( ) => {
9
8
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 ) ,
12
11
} as unknown as ApiClient ;
13
12
await ensureCurrentIpInAccessList ( apiClient , "projectId" ) ;
14
13
expect ( apiClient . createProjectIpAccessList ) . toHaveBeenCalledWith ( {
@@ -21,8 +20,8 @@ describe("accessListUtils", () => {
21
20
22
21
it ( "should not fail if the current IP is already in the access list" , async ( ) => {
23
22
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
26
25
. fn ( )
27
26
. mockRejectedValue (
28
27
ApiClientError . fromError (
0 commit comments