test-client.ts 654 B

12345678910111213141516171819
  1. import { getDefaultChannelToken } from '../mock-data/get-default-channel-token';
  2. import { SimpleGraphQLClient } from '../mock-data/simple-graphql-client';
  3. import { testConfig } from './config/test-config';
  4. /**
  5. * A GraphQL client for use in e2e tests configured to use the test server endpoint.
  6. */
  7. export class TestClient extends SimpleGraphQLClient {
  8. constructor() {
  9. super();
  10. }
  11. async init() {
  12. const testingConfig = testConfig;
  13. const token = await getDefaultChannelToken(testingConfig.dbConnectionOptions);
  14. super.apiUrl = `http://localhost:${testConfig.port}/${testConfig.apiPath}?token=${token}`;
  15. }
  16. }