forked from vendurehq/vendure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-client.ts
More file actions
34 lines (29 loc) · 1.02 KB
/
Copy pathtest-client.ts
File metadata and controls
34 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { getDefaultChannelToken } from '../mock-data/get-default-channel-token';
import { SimpleGraphQLClient } from '../mock-data/simple-graphql-client';
import { testConfig } from './config/test-config';
// tslint:disable:no-console
/**
* A GraphQL client for use in e2e tests configured to use the test admin server endpoint.
*/
export class TestAdminClient extends SimpleGraphQLClient {
constructor() {
super(`http://localhost:${testConfig.port}/${testConfig.adminApiPath}`);
}
async init() {
const token = await getDefaultChannelToken(false);
this.setChannelToken(token);
await this.asSuperAdmin();
}
}
/**
* A GraphQL client for use in e2e tests configured to use the test shop server endpoint.
*/
export class TestShopClient extends SimpleGraphQLClient {
constructor() {
super(`http://localhost:${testConfig.port}/${testConfig.shopApiPath}`);
}
async init() {
const token = await getDefaultChannelToken(false);
this.setChannelToken(token);
}
}