@vendure/testing 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +42 -42
- package/README.md +6 -6
- package/lib/data-population/mock-data.service.js +16 -16
- package/lib/simple-graphql-client.js +28 -28
- package/package.json +5 -5
- package/lib/utils/esm-utils.d.ts +0 -2
- package/lib/utils/esm-utils.js +0 -14
- package/lib/utils/esm-utils.js.map +0 -1
- package/lib/utils/get-default-channel-token.d.ts +0 -4
- package/lib/utils/get-default-channel-token.js +0 -35
- package/lib/utils/get-default-channel-token.js.map +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
# License
|
|
2
|
-
Copyright (C) Vendure GmbH
|
|
3
|
-
|
|
4
|
-
This software is available under two different licenses:
|
|
5
|
-
* GNU General Public License version 3 (GPLv3) as Vendure Community Edition
|
|
6
|
-
* Vendure Commercial License (VCL)
|
|
7
|
-
|
|
8
|
-
The default Vendure license, without a valid Vendure Commercial License agreement, is the Open-Source GPLv3 license.
|
|
9
|
-
|
|
10
|
-
## GNU General Public License version 3 (GPLv3)
|
|
11
|
-
|
|
12
|
-
If you decide to choose the GPLv3 license, you must comply with the following terms:
|
|
13
|
-
|
|
14
|
-
This program is free software: you can redistribute it and/or modify
|
|
15
|
-
it under the terms of the GNU General Public License as published by
|
|
16
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
17
|
-
(at your option) any later version.
|
|
18
|
-
|
|
19
|
-
This program is distributed in the hope that it will be useful,
|
|
20
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
22
|
-
GNU General Public License for more details.
|
|
23
|
-
|
|
24
|
-
You should have received a copy of the GNU General Public License
|
|
25
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
26
|
-
|
|
27
|
-
Additional permission under GNU GPL version 3 section 7:
|
|
28
|
-
|
|
29
|
-
An additional exception under section 7 of the GPL is included in the plugin-exception.txt file,
|
|
30
|
-
which allows you to distribute Vendure plugins (i.e. extensions) under a different license.
|
|
31
|
-
|
|
32
|
-
## Vendure Commercial License (VCL)
|
|
33
|
-
|
|
34
|
-
Alternatively, commercial and supported versions of the program - also known as
|
|
35
|
-
Commercial Distributions - must be used in accordance with the terms and conditions
|
|
36
|
-
contained in a separate written agreement between you and Vendure GmbH.
|
|
37
|
-
For more information about the Vendure Commercial License (VCL) please contact contact@vendure.io.
|
|
38
|
-
|
|
39
|
-
Please see also:
|
|
40
|
-
|
|
41
|
-
- [Licensing FAQ - license-faq.md](license/license-faq.md)
|
|
42
|
-
- [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - gpl-3.0.txt](license/gpl-3.0.txt)
|
|
1
|
+
# License
|
|
2
|
+
Copyright (C) Vendure GmbH
|
|
3
|
+
|
|
4
|
+
This software is available under two different licenses:
|
|
5
|
+
* GNU General Public License version 3 (GPLv3) as Vendure Community Edition
|
|
6
|
+
* Vendure Commercial License (VCL)
|
|
7
|
+
|
|
8
|
+
The default Vendure license, without a valid Vendure Commercial License agreement, is the Open-Source GPLv3 license.
|
|
9
|
+
|
|
10
|
+
## GNU General Public License version 3 (GPLv3)
|
|
11
|
+
|
|
12
|
+
If you decide to choose the GPLv3 license, you must comply with the following terms:
|
|
13
|
+
|
|
14
|
+
This program is free software: you can redistribute it and/or modify
|
|
15
|
+
it under the terms of the GNU General Public License as published by
|
|
16
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
17
|
+
(at your option) any later version.
|
|
18
|
+
|
|
19
|
+
This program is distributed in the hope that it will be useful,
|
|
20
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
22
|
+
GNU General Public License for more details.
|
|
23
|
+
|
|
24
|
+
You should have received a copy of the GNU General Public License
|
|
25
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
26
|
+
|
|
27
|
+
Additional permission under GNU GPL version 3 section 7:
|
|
28
|
+
|
|
29
|
+
An additional exception under section 7 of the GPL is included in the plugin-exception.txt file,
|
|
30
|
+
which allows you to distribute Vendure plugins (i.e. extensions) under a different license.
|
|
31
|
+
|
|
32
|
+
## Vendure Commercial License (VCL)
|
|
33
|
+
|
|
34
|
+
Alternatively, commercial and supported versions of the program - also known as
|
|
35
|
+
Commercial Distributions - must be used in accordance with the terms and conditions
|
|
36
|
+
contained in a separate written agreement between you and Vendure GmbH.
|
|
37
|
+
For more information about the Vendure Commercial License (VCL) please contact contact@vendure.io.
|
|
38
|
+
|
|
39
|
+
Please see also:
|
|
40
|
+
|
|
41
|
+
- [Licensing FAQ - license-faq.md](license/license-faq.md)
|
|
42
|
+
- [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - gpl-3.0.txt](license/gpl-3.0.txt)
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# @vendure/testing
|
|
2
|
-
|
|
3
|
-
This package contains utilities for writing end-to-end tests for Vendure.
|
|
4
|
-
|
|
5
|
-
For documentation, see [www.vendure.io/docs/developer-guide/testing/](https://www.vendure.io/docs/developer-guide/testing/)
|
|
6
|
-
|
|
1
|
+
# @vendure/testing
|
|
2
|
+
|
|
3
|
+
This package contains utilities for writing end-to-end tests for Vendure.
|
|
4
|
+
|
|
5
|
+
For documentation, see [www.vendure.io/docs/developer-guide/testing/](https://www.vendure.io/docs/developer-guide/testing/)
|
|
6
|
+
|
|
@@ -49,15 +49,15 @@ class MockDataService {
|
|
|
49
49
|
for (let i = 0; i < count; i++) {
|
|
50
50
|
const firstName = en_GB_1.default.name.firstName();
|
|
51
51
|
const lastName = en_GB_1.default.name.lastName();
|
|
52
|
-
const query1 = (0, graphql_tag_1.default) `
|
|
53
|
-
mutation CreateCustomer($input: CreateCustomerInput!, $password: String) {
|
|
54
|
-
createCustomer(input: $input, password: $password) {
|
|
55
|
-
... on Customer {
|
|
56
|
-
id
|
|
57
|
-
emailAddress
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
52
|
+
const query1 = (0, graphql_tag_1.default) `
|
|
53
|
+
mutation CreateCustomer($input: CreateCustomerInput!, $password: String) {
|
|
54
|
+
createCustomer(input: $input, password: $password) {
|
|
55
|
+
... on Customer {
|
|
56
|
+
id
|
|
57
|
+
emailAddress
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
61
|
`;
|
|
62
62
|
const variables1 = {
|
|
63
63
|
input: {
|
|
@@ -72,13 +72,13 @@ class MockDataService {
|
|
|
72
72
|
.query(query1, variables1)
|
|
73
73
|
.then((data) => data.createCustomer, err => this.log(err));
|
|
74
74
|
if (customer) {
|
|
75
|
-
const query2 = (0, graphql_tag_1.default) `
|
|
76
|
-
mutation ($customerId: ID!, $input: CreateAddressInput!) {
|
|
77
|
-
createCustomerAddress(customerId: $customerId, input: $input) {
|
|
78
|
-
id
|
|
79
|
-
streetLine1
|
|
80
|
-
}
|
|
81
|
-
}
|
|
75
|
+
const query2 = (0, graphql_tag_1.default) `
|
|
76
|
+
mutation ($customerId: ID!, $input: CreateAddressInput!) {
|
|
77
|
+
createCustomerAddress(customerId: $customerId, input: $input) {
|
|
78
|
+
id
|
|
79
|
+
streetLine1
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
82
|
`;
|
|
83
83
|
const variables2 = {
|
|
84
84
|
input: {
|
|
@@ -12,22 +12,22 @@ const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
|
12
12
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
13
13
|
const querystring_1 = require("querystring");
|
|
14
14
|
const create_upload_post_data_1 = require("./utils/create-upload-post-data");
|
|
15
|
-
const LOGIN = (0, graphql_tag_1.default) `
|
|
16
|
-
mutation ($username: String!, $password: String!) {
|
|
17
|
-
login(username: $username, password: $password) {
|
|
18
|
-
... on CurrentUser {
|
|
19
|
-
id
|
|
20
|
-
identifier
|
|
21
|
-
channels {
|
|
22
|
-
token
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
... on ErrorResult {
|
|
26
|
-
errorCode
|
|
27
|
-
message
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
15
|
+
const LOGIN = (0, graphql_tag_1.default) `
|
|
16
|
+
mutation ($username: String!, $password: String!) {
|
|
17
|
+
login(username: $username, password: $password) {
|
|
18
|
+
... on CurrentUser {
|
|
19
|
+
id
|
|
20
|
+
identifier
|
|
21
|
+
channels {
|
|
22
|
+
token
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
... on ErrorResult {
|
|
26
|
+
errorCode
|
|
27
|
+
message
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
31
|
`;
|
|
32
32
|
/* eslint-disable no-console */
|
|
33
33
|
/**
|
|
@@ -116,12 +116,12 @@ class SimpleGraphQLClient {
|
|
|
116
116
|
var _a;
|
|
117
117
|
// first log out as the current user
|
|
118
118
|
if (this.authToken) {
|
|
119
|
-
await this.query((0, graphql_tag_1.default) `
|
|
120
|
-
mutation {
|
|
121
|
-
logout {
|
|
122
|
-
success
|
|
123
|
-
}
|
|
124
|
-
}
|
|
119
|
+
await this.query((0, graphql_tag_1.default) `
|
|
120
|
+
mutation {
|
|
121
|
+
logout {
|
|
122
|
+
success
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
125
|
`);
|
|
126
126
|
}
|
|
127
127
|
const result = await this.query(LOGIN, { username, password });
|
|
@@ -144,12 +144,12 @@ class SimpleGraphQLClient {
|
|
|
144
144
|
* Logs out so that the client is then treated as an anonymous user.
|
|
145
145
|
*/
|
|
146
146
|
async asAnonymousUser() {
|
|
147
|
-
await this.query((0, graphql_tag_1.default) `
|
|
148
|
-
mutation {
|
|
149
|
-
logout {
|
|
150
|
-
success
|
|
151
|
-
}
|
|
152
|
-
}
|
|
147
|
+
await this.query((0, graphql_tag_1.default) `
|
|
148
|
+
mutation {
|
|
149
|
+
logout {
|
|
150
|
+
success
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
153
|
`);
|
|
154
154
|
}
|
|
155
155
|
async makeGraphQlRequest(query, variables, queryParams) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/testing",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "End-to-end testing tools for Vendure projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vendure",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"types": "lib/index.d.ts",
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "
|
|
26
|
+
"url": "https://github.com/vendure-ecommerce/vendure"
|
|
27
27
|
},
|
|
28
28
|
"funding": "https://github.com/sponsors/michaelbromley",
|
|
29
29
|
"scripts": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
41
|
-
"@vendure/common": "^3.2.
|
|
41
|
+
"@vendure/common": "^3.2.1",
|
|
42
42
|
"faker": "^4.1.0",
|
|
43
43
|
"form-data": "^4.0.0",
|
|
44
44
|
"graphql": "^16.10.0",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"@types/mysql": "^2.15.26",
|
|
52
52
|
"@types/node-fetch": "^2.6.4",
|
|
53
53
|
"@types/pg": "^8.11.2",
|
|
54
|
-
"@vendure/core": "^3.2.
|
|
54
|
+
"@vendure/core": "^3.2.1",
|
|
55
55
|
"mysql": "^2.18.1",
|
|
56
56
|
"pg": "^8.11.3",
|
|
57
57
|
"rimraf": "^5.0.5",
|
|
58
58
|
"typescript": "5.8.2"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "d86ca35d52e64990f5cb17dad476c6315a2e548c"
|
|
61
61
|
}
|
package/lib/utils/esm-utils.d.ts
DELETED
package/lib/utils/esm-utils.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filename = exports.dirname = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const url_1 = require("url");
|
|
6
|
-
function dirname(importMeta) {
|
|
7
|
-
return (0, path_1.dirname)(filename(importMeta));
|
|
8
|
-
}
|
|
9
|
-
exports.dirname = dirname;
|
|
10
|
-
function filename(importMeta) {
|
|
11
|
-
return importMeta.url ? (0, url_1.fileURLToPath)(importMeta.url) : '';
|
|
12
|
-
}
|
|
13
|
-
exports.filename = filename;
|
|
14
|
-
//# sourceMappingURL=esm-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esm-utils.js","sourceRoot":"","sources":["../../src/utils/esm-utils.ts"],"names":[],"mappings":";;;AAAA,+BAA8C;AAC9C,6BAAoC;AAEpC,SAAgB,OAAO,CAAC,UAAe;IACnC,OAAO,IAAA,cAAW,EAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AAC7C,CAAC;AAFD,0BAEC;AAED,SAAgB,QAAQ,CAAC,UAAe;IACpC,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,mBAAa,EAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/D,CAAC;AAFD,4BAEC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultChannelToken = void 0;
|
|
4
|
-
const shared_constants_1 = require("@vendure/common/lib/shared-constants");
|
|
5
|
-
const core_1 = require("@vendure/core");
|
|
6
|
-
const typeorm_1 = require("typeorm");
|
|
7
|
-
// tslint:disable:no-console
|
|
8
|
-
// tslint:disable:no-floating-promises
|
|
9
|
-
/**
|
|
10
|
-
* Queries the database for the default Channel and returns its token.
|
|
11
|
-
*/
|
|
12
|
-
async function getDefaultChannelToken(logging = true) {
|
|
13
|
-
const connection = await typeorm_1.getConnection();
|
|
14
|
-
let defaultChannel;
|
|
15
|
-
try {
|
|
16
|
-
defaultChannel = await connection.manager.getRepository(core_1.Channel).findOne({
|
|
17
|
-
where: {
|
|
18
|
-
code: shared_constants_1.DEFAULT_CHANNEL_CODE,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
console.log(`Error occurred when attempting to get default Channel`);
|
|
24
|
-
console.log(err);
|
|
25
|
-
}
|
|
26
|
-
if (!defaultChannel) {
|
|
27
|
-
throw new Error(`No default channel could be found!`);
|
|
28
|
-
}
|
|
29
|
-
if (logging) {
|
|
30
|
-
console.log(`Got default channel token: ${defaultChannel.token}`);
|
|
31
|
-
}
|
|
32
|
-
return defaultChannel.token;
|
|
33
|
-
}
|
|
34
|
-
exports.getDefaultChannelToken = getDefaultChannelToken;
|
|
35
|
-
//# sourceMappingURL=get-default-channel-token.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-channel-token.js","sourceRoot":"","sources":["../../src/utils/get-default-channel-token.ts"],"names":[],"mappings":";;;AAAA,2EAA4E;AAC5E,wCAAwC;AACxC,qCAA2D;AAE3D,4BAA4B;AAC5B,sCAAsC;AACtC;;GAEG;AACI,KAAK,UAAU,sBAAsB,CAAC,OAAO,GAAG,IAAI;IACvD,MAAM,UAAU,GAAG,MAAM,uBAAa,EAAE,CAAC;IACzC,IAAI,cAAmC,CAAC;IACxC,IAAI;QACA,cAAc,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,cAAO,CAAC,CAAC,OAAO,CAAC;YACrE,KAAK,EAAE;gBACH,IAAI,EAAE,uCAAoB;aAC7B;SACJ,CAAC,CAAC;KACN;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACpB;IACD,IAAI,CAAC,cAAc,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;KACzD;IACD,IAAI,OAAO,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,8BAA8B,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC;KACrE;IACD,OAAO,cAAc,CAAC,KAAK,CAAC;AAChC,CAAC;AApBD,wDAoBC"}
|