@semic/testing
v2.2.11
Published
## create dev server
Downloads
2
Readme
@semic/testing
create dev server
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"
),
});
create e2e testing server
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);