Skip to content

Commit 86e16d8

Browse files
committed
test(*): enable batch api once on test setup
1 parent d5d5166 commit 86e16d8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

test/_mocks/batch-requests.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ export async function sendBatchRequest(
1010
options: PocketBaseLoaderBaseOptions,
1111
superuserToken: string
1212
): Promise<any> {
13-
await enableBatchApi(options, superuserToken);
14-
1513
const batchRequest = await fetch(new URL(`api/batch`, options.url), {
1614
method: "POST",
1715
headers: {
@@ -26,7 +24,7 @@ export async function sendBatchRequest(
2624
return batchRequest.json();
2725
}
2826

29-
async function enableBatchApi(
27+
export async function enableBatchApi(
3028
options: PocketBaseLoaderBaseOptions,
3129
superuserToken: string
3230
): Promise<void> {

test/global-setup.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { assert } from "vitest";
22
import type { TestProject } from "vitest/node";
33
import { getSuperuserToken } from "../src/utils/get-superuser-token";
4+
import { enableBatchApi } from "./_mocks/batch-requests";
45
import { checkE2eConnection } from "./_mocks/check-e2e-connection";
56
import { createLoaderOptions } from "./_mocks/create-loader-options";
67

@@ -38,6 +39,9 @@ export async function setup(project: TestProject): Promise<void> {
3839

3940
// Provide superuser token to tests
4041
project.provide("superuserToken", token);
42+
43+
// Enable batch API for e2e tests
44+
await enableBatchApi(options, token);
4145
}
4246

4347
declare module "vitest" {

0 commit comments

Comments
 (0)