CreateTestEnvironment
createTestEnvironment
Configures a TestServer and a SimpleGraphQLClient for each of the GraphQL APIs for use in end-to-end tests. Returns a TestEnvironment object.
Example
import { createTestEnvironment, testConfig } from '@vendure/testing';
describe('some feature to test', () => {
const { server, adminClient, shopClient } = createTestEnvironment(testConfig);
beforeAll(async () => {
await server.init({
// ... server options
});
await adminClient.asSuperAdmin();
});
afterAll(async () => {
await server.destroy();
});
// ... end-to-end tests here
});
Signature
function createTestEnvironment(config: Required<VendureConfig>): TestEnvironment
Parameters
config
parameter
Required<VendureConfig>