jaypie 0.1.5 → 0.1.7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jaypie",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"author": "Finlayson Studio",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test:spec:mongoose.package": "vitest run ./src/__tests__/mongoose.package.spec.js"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@jaypie/core": "^0.4.
|
|
20
|
+
"@jaypie/core": "^0.4.2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@jaypie/testkit": "^1.0.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@jaypie/aws": "^0.1.1",
|
|
37
|
-
"@jaypie/lambda": "^0.1.
|
|
37
|
+
"@jaypie/lambda": "^0.1.4",
|
|
38
38
|
"@jaypie/mongoose": "^0.1.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
@@ -73,25 +73,6 @@ describe("Dynamic Export Function", () => {
|
|
|
73
73
|
it("Returns an object", () => {
|
|
74
74
|
expect(dynamicExport({ moduleImport: MOCK.MODULE })).toBeObject();
|
|
75
75
|
});
|
|
76
|
-
it("If module is not found and you try to get a scalar it will throw", async () => {
|
|
77
|
-
const vars = ["scalar"];
|
|
78
|
-
const result = await dynamicExport({
|
|
79
|
-
vars,
|
|
80
|
-
moduleImport: MOCK.MODULE,
|
|
81
|
-
});
|
|
82
|
-
await expect(() => {
|
|
83
|
-
console.log("result.scalar :>> ", result.scalar);
|
|
84
|
-
try {
|
|
85
|
-
console.log("result.scalar.taco :>> ", result.scalar.taco);
|
|
86
|
-
} catch (error) {
|
|
87
|
-
console.log("error :>> ", error);
|
|
88
|
-
}
|
|
89
|
-
if (result.scalar) {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
return false;
|
|
93
|
-
}).toThrow();
|
|
94
|
-
});
|
|
95
76
|
it("Exported functions throw if the real module is not installed", async () => {
|
|
96
77
|
const functions = ["default"];
|
|
97
78
|
const result = await dynamicExport({
|
|
@@ -102,7 +83,15 @@ describe("Dynamic Export Function", () => {
|
|
|
102
83
|
result.default();
|
|
103
84
|
}).toThrow();
|
|
104
85
|
});
|
|
105
|
-
it("
|
|
86
|
+
it("Vars return null if the real module is not installed", async () => {
|
|
87
|
+
const vars = ["scalar"];
|
|
88
|
+
const result = await dynamicExport({
|
|
89
|
+
vars,
|
|
90
|
+
moduleImport: MOCK.MODULE,
|
|
91
|
+
});
|
|
92
|
+
expect(result.scalar).toBeNull();
|
|
93
|
+
});
|
|
94
|
+
it("Vars that never existed are undefined", async () => {
|
|
106
95
|
const vars = ["scalar"];
|
|
107
96
|
const result = await dynamicExport({
|
|
108
97
|
vars,
|
|
@@ -66,18 +66,14 @@ export default async ({
|
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
// Return
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return undefined;
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
);
|
|
69
|
+
const result = {};
|
|
70
|
+
functions.forEach((func) => {
|
|
71
|
+
result[func] = () => {
|
|
72
|
+
throw new ConfigurationError(`${moduleImport}.${func} is not available`);
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
vars.forEach((variable) => {
|
|
76
|
+
result[variable] = null;
|
|
77
|
+
});
|
|
78
|
+
return result;
|
|
83
79
|
};
|