patron-oop 1.30.0 → 1.32.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +15 -0
- package/README.md +0 -60
- package/dist/patron.cjs +65 -0
- package/dist/patron.cjs.map +1 -1
- package/dist/patron.d.ts +32 -1
- package/dist/patron.js +63 -1
- package/dist/patron.js.map +1 -1
- package/dist/patron.min.js +1 -1
- package/dist/patron.min.mjs +1 -1
- package/dist/patron.min.mjs.map +1 -1
- package/dist/patron.mjs +63 -1
- package/dist/patron.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Guest/Guest.test.ts +1 -1
- package/src/Guest/GuestAware.test.ts +1 -1
- package/src/Guest/GuestAwareMap.test.ts +32 -0
- package/src/Guest/GuestAwareMap.ts +35 -0
- package/src/Guest/GuestAwareRace.test.ts +47 -0
- package/src/Guest/GuestAwareRace.ts +26 -0
- package/src/Guest/GuestCast.test.ts +1 -1
- package/src/Guest/GuestChain._asArray.test.ts +19 -0
- package/src/Guest/GuestChain._twoValuesAfter.test.ts +16 -0
- package/src/Guest/GuestChain._twoValuesBefore.test.ts +16 -0
- package/src/Guest/GuestChain._withPatron.test.ts +22 -0
- package/src/Guest/GuestDisposable.test.ts +1 -1
- package/src/Guest/GuestObject.test.ts +1 -1
- package/src/Guest/GuestPool.test.ts +1 -1
- package/src/Guest/GuestSync.test.ts +1 -1
- package/src/Patron/Patron.test.ts +1 -1
- package/src/Patron/PatronOnce.test.ts +1 -1
- package/src/Patron/PatronPool.test.ts +1 -1
- package/src/Source/Source.test.ts +1 -1
- package/src/Source/SourceDynamic.ofSource.test.ts +21 -0
- package/src/Source/SourceDynamic.test.ts +26 -0
- package/src/Source/SourceDynamic.ts +28 -0
- package/src/Source/SourceEmpty.test.ts +1 -1
- package/src/index.ts +3 -0
- package/src/Guest/GuestChain.test.ts +0 -63
@@ -1,63 +0,0 @@
|
|
1
|
-
import { expect, test } from "vitest";
|
2
|
-
import { GuestChain } from "./GuestChain";
|
3
|
-
import { Source } from "../Source/Source";
|
4
|
-
import { Patron } from "../Patron/Patron";
|
5
|
-
|
6
|
-
test("chain guest returns 2 values after result guest", () => {
|
7
|
-
const one = new Source(1);
|
8
|
-
const two = new Source(2);
|
9
|
-
const chain = new GuestChain<{ one: number; two: number }>();
|
10
|
-
|
11
|
-
chain.result((value) => {
|
12
|
-
expect(Object.values(value).join()).toBe("1,2");
|
13
|
-
});
|
14
|
-
|
15
|
-
one.value(chain.receiveKey("one"));
|
16
|
-
two.value(chain.receiveKey("two"));
|
17
|
-
});
|
18
|
-
|
19
|
-
test("chain guest returns 2 values before result guest", () => {
|
20
|
-
const one = new Source(1);
|
21
|
-
const two = new Source(2);
|
22
|
-
const chain = new GuestChain<{ one: number; two: number }>();
|
23
|
-
|
24
|
-
one.value(chain.receiveKey("one"));
|
25
|
-
two.value(chain.receiveKey("two"));
|
26
|
-
|
27
|
-
chain.result((value) => {
|
28
|
-
expect(Object.values(value).join()).toBe("1,2");
|
29
|
-
});
|
30
|
-
});
|
31
|
-
|
32
|
-
test("chain with patron", () => {
|
33
|
-
const one = new Source(1);
|
34
|
-
const two = new Source(2);
|
35
|
-
const chain = new GuestChain<{ one: number; two: number }>();
|
36
|
-
|
37
|
-
one.value(new Patron(chain.receiveKey("one")));
|
38
|
-
two.value(new Patron(chain.receiveKey("two")));
|
39
|
-
|
40
|
-
one.give(3);
|
41
|
-
one.give(4);
|
42
|
-
|
43
|
-
chain.result(
|
44
|
-
new Patron((value: Record<string, unknown>) => {
|
45
|
-
expect(Object.values(value).length).toBe(2);
|
46
|
-
}),
|
47
|
-
);
|
48
|
-
});
|
49
|
-
|
50
|
-
test("chain as array", () => {
|
51
|
-
const one = new Source(1);
|
52
|
-
const two = new Source(2);
|
53
|
-
const chain = new GuestChain<[number, number]>();
|
54
|
-
|
55
|
-
one.value(new Patron(chain.receiveKey("0")));
|
56
|
-
two.value(new Patron(chain.receiveKey("1")));
|
57
|
-
|
58
|
-
chain.resultArray(
|
59
|
-
new Patron((value) => {
|
60
|
-
expect(JSON.stringify(value)).toBe("[1,2]");
|
61
|
-
}),
|
62
|
-
);
|
63
|
-
});
|