@tinkered/core 0.28.0 → 0.29.2
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
package/skills/core/SKILL.md
CHANGED
package/skills/core/rpc/SKILL.md
CHANGED
|
@@ -12,7 +12,7 @@ metadata:
|
|
|
12
12
|
and join two scopes with the memory backend.
|
|
13
13
|
type: sub-skill
|
|
14
14
|
library: '@tinkered/core'
|
|
15
|
-
library_version: '0.
|
|
15
|
+
library_version: '0.29.2'
|
|
16
16
|
requires:
|
|
17
17
|
- core
|
|
18
18
|
sources:
|
|
@@ -175,6 +175,45 @@ and assert on the result.
|
|
|
175
175
|
that fails by chance. Use `makeTestClock` and
|
|
176
176
|
`clock.advance`.
|
|
177
177
|
|
|
178
|
+
### HIGH: an exit that no test reaches [tinker/exit]
|
|
179
|
+
|
|
180
|
+
An operation's `run` type declares its exits:
|
|
181
|
+
each answer `kind`, a hook's refusal, and a plain
|
|
182
|
+
return. `tinker check` runs the tests and names
|
|
183
|
+
each exit that no test reached.
|
|
184
|
+
|
|
185
|
+
Wrong:
|
|
186
|
+
|
|
187
|
+
```ts no-check
|
|
188
|
+
// run answers "moved" | "stale" | "gone"
|
|
189
|
+
const out = await tab.run(api["issue.move"], call);
|
|
190
|
+
expect(out).toEqual({ kind: "moved", version: 2 });
|
|
191
|
+
// no test gets "stale" or "gone"
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Right: a test for each exit the check names. The
|
|
195
|
+
test makes the state that gives that answer, runs
|
|
196
|
+
the operation through a scope, and asserts on the
|
|
197
|
+
answer. The scope lists the `exits` capsule first:
|
|
198
|
+
|
|
199
|
+
```ts no-check
|
|
200
|
+
import { exits } from "@tinkered/cli/test";
|
|
201
|
+
|
|
202
|
+
const scope = createScope({
|
|
203
|
+
capsules: [
|
|
204
|
+
exits({ file: process.env.TINKER_EXITS }),
|
|
205
|
+
board.api({ implement: ops }),
|
|
206
|
+
],
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
In a browser test the scope has no file. It
|
|
211
|
+
passes the page's store:
|
|
212
|
+
`exits({ store: localStorage })`.
|
|
213
|
+
|
|
214
|
+
If no state can give the answer, remove it from
|
|
215
|
+
the operation.
|
|
216
|
+
|
|
178
217
|
### MEDIUM: a scope that stays open
|
|
179
218
|
|
|
180
219
|
An open scope keeps timers and sockets. Close
|