@h-rig/plugin-testkit 0.0.6-alpha.153 → 0.0.6-alpha.154
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/dist/src/behavior.js +6 -6
- package/dist/src/index.js +6 -6
- package/package.json +3 -3
package/dist/src/behavior.js
CHANGED
|
@@ -9,9 +9,9 @@ var DEFAULT_VALIDATOR_CONTEXT = {
|
|
|
9
9
|
scope: []
|
|
10
10
|
};
|
|
11
11
|
async function testValidatorContext(plugin, id, mockCtx = {}) {
|
|
12
|
-
const validator = plugin.
|
|
12
|
+
const validator = plugin.validators?.find((v) => v.id === id);
|
|
13
13
|
if (!validator) {
|
|
14
|
-
fail(plugin, `no executable validator "${id}" in the
|
|
14
|
+
fail(plugin, `no executable validator "${id}" in the plugin object`);
|
|
15
15
|
}
|
|
16
16
|
const result = await validator.run({ ...DEFAULT_VALIDATOR_CONTEXT, ...mockCtx });
|
|
17
17
|
if (typeof result?.id !== "string" || result.id !== id) {
|
|
@@ -26,9 +26,9 @@ async function testValidatorContext(plugin, id, mockCtx = {}) {
|
|
|
26
26
|
return result;
|
|
27
27
|
}
|
|
28
28
|
function expectTaskSourceRuntime(plugin, kind, config) {
|
|
29
|
-
const entry = plugin.
|
|
29
|
+
const entry = plugin.taskSources?.find((s) => s.kind === kind);
|
|
30
30
|
if (!entry) {
|
|
31
|
-
fail(plugin, `no executable task-source factory for kind "${kind}" in the
|
|
31
|
+
fail(plugin, `no executable task-source factory for kind "${kind}" in the plugin object`);
|
|
32
32
|
}
|
|
33
33
|
const source = entry.factory(config ?? { kind });
|
|
34
34
|
if (!source || typeof source !== "object") {
|
|
@@ -46,9 +46,9 @@ function expectTaskSourceRuntime(plugin, kind, config) {
|
|
|
46
46
|
return source;
|
|
47
47
|
}
|
|
48
48
|
async function testHook(plugin, id, mockInput = {}) {
|
|
49
|
-
const implementation = plugin.
|
|
49
|
+
const implementation = plugin.hooks?.[id];
|
|
50
50
|
if (!implementation) {
|
|
51
|
-
fail(plugin, `no typed hook implementation "${id}" in the
|
|
51
|
+
fail(plugin, `no typed hook implementation "${id}" in the plugin object`);
|
|
52
52
|
}
|
|
53
53
|
const registration = (plugin.contributes?.hooks ?? []).find((h) => h.id === id);
|
|
54
54
|
if (!registration) {
|
package/dist/src/index.js
CHANGED
|
@@ -14,9 +14,9 @@ var DEFAULT_VALIDATOR_CONTEXT = {
|
|
|
14
14
|
scope: []
|
|
15
15
|
};
|
|
16
16
|
async function testValidatorContext(plugin, id, mockCtx = {}) {
|
|
17
|
-
const validator = plugin.
|
|
17
|
+
const validator = plugin.validators?.find((v) => v.id === id);
|
|
18
18
|
if (!validator) {
|
|
19
|
-
fail(plugin, `no executable validator "${id}" in the
|
|
19
|
+
fail(plugin, `no executable validator "${id}" in the plugin object`);
|
|
20
20
|
}
|
|
21
21
|
const result = await validator.run({ ...DEFAULT_VALIDATOR_CONTEXT, ...mockCtx });
|
|
22
22
|
if (typeof result?.id !== "string" || result.id !== id) {
|
|
@@ -31,9 +31,9 @@ async function testValidatorContext(plugin, id, mockCtx = {}) {
|
|
|
31
31
|
return result;
|
|
32
32
|
}
|
|
33
33
|
function expectTaskSourceRuntime(plugin, kind, config) {
|
|
34
|
-
const entry = plugin.
|
|
34
|
+
const entry = plugin.taskSources?.find((s) => s.kind === kind);
|
|
35
35
|
if (!entry) {
|
|
36
|
-
fail(plugin, `no executable task-source factory for kind "${kind}" in the
|
|
36
|
+
fail(plugin, `no executable task-source factory for kind "${kind}" in the plugin object`);
|
|
37
37
|
}
|
|
38
38
|
const source = entry.factory(config ?? { kind });
|
|
39
39
|
if (!source || typeof source !== "object") {
|
|
@@ -51,9 +51,9 @@ function expectTaskSourceRuntime(plugin, kind, config) {
|
|
|
51
51
|
return source;
|
|
52
52
|
}
|
|
53
53
|
async function testHook(plugin, id, mockInput = {}) {
|
|
54
|
-
const implementation = plugin.
|
|
54
|
+
const implementation = plugin.hooks?.[id];
|
|
55
55
|
if (!implementation) {
|
|
56
|
-
fail(plugin, `no typed hook implementation "${id}" in the
|
|
56
|
+
fail(plugin, `no typed hook implementation "${id}" in the plugin object`);
|
|
57
57
|
}
|
|
58
58
|
const registration = (plugin.contributes?.hooks ?? []).find((h) => h.id === id);
|
|
59
59
|
if (!registration) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-rig/plugin-testkit",
|
|
3
|
-
"version": "0.0.6-alpha.
|
|
3
|
+
"version": "0.0.6-alpha.154",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Test helpers for Rig plugin packages; not a runtime runner, host, or control plane.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"module": "./dist/src/index.js",
|
|
22
22
|
"types": "./dist/src/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.
|
|
25
|
-
"@rig/core": "npm:@h-rig/core@0.0.6-alpha.
|
|
24
|
+
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.154",
|
|
25
|
+
"@rig/core": "npm:@h-rig/core@0.0.6-alpha.154",
|
|
26
26
|
"effect": "4.0.0-beta.90",
|
|
27
27
|
"vitest": "^4.0.0"
|
|
28
28
|
}
|