2.2.11 • Published 4 months ago

@semic/testing v2.2.11

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

@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);
2.2.11

4 months ago

2.2.7

5 months ago

2.2.9

5 months ago

2.2.10

5 months ago

2.2.8

5 months ago

2.2.5

6 months ago

2.2.6

6 months ago

2.2.4

6 months ago