@orion-js/graphql 3.4.10 → 3.4.11
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.
|
@@ -28,7 +28,10 @@ exports.default = (0, models_1.createModel)({
|
|
|
28
28
|
result: (0, resolvers_1.resolver)({
|
|
29
29
|
returns: String,
|
|
30
30
|
resolve: async function ({ resolver }) {
|
|
31
|
-
|
|
31
|
+
const returns = (0, lodash_1.isArray)(resolver.returns) ? resolver.returns[0] : resolver.returns;
|
|
32
|
+
if (resolverReturnsIsModel(returns))
|
|
33
|
+
return returns.name;
|
|
34
|
+
return;
|
|
32
35
|
}
|
|
33
36
|
}),
|
|
34
37
|
basicResultQuery: (0, resolvers_1.resolver)({
|
|
@@ -34,6 +34,32 @@ describe('Get params tests', () => {
|
|
|
34
34
|
expect(result).toEqual(undefined);
|
|
35
35
|
expect(basicResultQuery).toEqual('');
|
|
36
36
|
});
|
|
37
|
+
it('Should return the correct information for a resolver that returns a string', async () => {
|
|
38
|
+
resolversStore_1.resolversStore.aaResolver = (0, resolvers_1.resolver)({
|
|
39
|
+
params: {
|
|
40
|
+
aParam: {
|
|
41
|
+
type: String
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
returns: [String],
|
|
45
|
+
async resolve() {
|
|
46
|
+
return 'a';
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const response = (await params_1.default.execute({
|
|
50
|
+
params: {
|
|
51
|
+
name: 'aaResolver',
|
|
52
|
+
mutation: false
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
const params = await response.params();
|
|
56
|
+
const result = await response.result();
|
|
57
|
+
const basicResultQuery = await response.basicResultQuery();
|
|
58
|
+
expect(response.name).toEqual('aaResolver');
|
|
59
|
+
expect(params).toEqual({ aParam: { type: 'string', __graphQLType: 'String' } });
|
|
60
|
+
expect(result).toEqual(undefined);
|
|
61
|
+
expect(basicResultQuery).toEqual('');
|
|
62
|
+
});
|
|
37
63
|
it('Should return the correct information for a resolver that returns a array of a model', async () => {
|
|
38
64
|
const model = (0, models_1.createModel)({
|
|
39
65
|
name: 'Item',
|
|
@@ -65,7 +91,7 @@ describe('Get params tests', () => {
|
|
|
65
91
|
const basicResultQuery = await response.basicResultQuery();
|
|
66
92
|
expect(response.name).toEqual('bResolver');
|
|
67
93
|
expect(params).toEqual({ aParam: { type: 'string', __graphQLType: 'String' } });
|
|
68
|
-
expect(result).toEqual(
|
|
94
|
+
expect(result).toEqual('Item');
|
|
69
95
|
expect(basicResultQuery).toEqual('{ name }');
|
|
70
96
|
});
|
|
71
97
|
it('Should return the correct information for a resolver that returns a model', async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/graphql",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.11",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "nicolaslopezj",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "99aec486f0d9343d9bc2c3bacf430217b0bc7dba"
|
|
55
55
|
}
|