test-client.ts 640 B

1234567891011121314151617181920
  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. // tslint:disable:no-console
  5. /**
  6. * A GraphQL client for use in e2e tests configured to use the test server endpoint.
  7. */
  8. export class TestClient extends SimpleGraphQLClient {
  9. constructor() {
  10. super(`http://localhost:${testConfig.port}/${testConfig.apiPath}`);
  11. }
  12. async init() {
  13. const token = await getDefaultChannelToken();
  14. this.setChannelToken(token);
  15. await this.asSuperAdmin();
  16. }
  17. }