import { getDirname } from "@semic/common";
import { createTestServer, initialData } from "@semic/testing";
import { registerInitializer, SqljsInitializer } from "@vendure/testing";
import { config } from "dotenv";
import { SemicAdminPlugin } from "../src/admin.plugin.js";
config();
registerInitializer("sqljs", new SqljsInitializer("__data__"));
const { server } = await createTestServer({
type: "dev-server",
metaUrl: import.meta.url,
overridePlugins: {
plugins: [
SemicAdminPlugin.init({
...
}),
],
},
});
await server.init({
initialData,
productsCsvPath: getDirname(
import.meta.url,
"../../testing/mock-data/products.csv"
),
});
let server: TestServer;
let shopClient: SimpleGraphQLClient;
let adminClient: SimpleGraphQLClient;
const serverStarted = false;
beforeAll(async () => {
registerInitializer("sqljs", new SqljsInitializer("__data__"));
({ server, adminClient, shopClient } = await createTestServer({
type: "e2e",
metaUrl: import.meta.url,
overridePlugins: {
plugins: [
SemicAdminPlugin.init({
...
}),
],
},
}));
await server.init({
initialData,
productsCsvPath: getDirname(
import.meta.url,
"../../testing/mock-data/products.csv"
),
});
await adminClient.asSuperAdmin();
}, 60000);