tutuca 0.9.71 → 0.9.73

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.
@@ -1,114 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- function __accessProp(key) {
5
- return this[key];
6
- }
7
- var __reExport = (target, mod, secondTarget) => {
8
- var keys = __getOwnPropNames(mod);
9
- for (let key of keys)
10
- if (!__hasOwnProp.call(target, key) && key !== "default")
11
- __defProp(target, key, {
12
- get: __accessProp.bind(mod, key),
13
- enumerable: true
14
- });
15
- if (secondTarget) {
16
- for (let key of keys)
17
- if (!__hasOwnProp.call(secondTarget, key) && key !== "default")
18
- __defProp(secondTarget, key, {
19
- get: __accessProp.bind(mod, key),
20
- enumerable: true
21
- });
22
- return secondTarget;
23
- }
24
- };
25
- var __returnValue = (v) => v;
26
- function __exportSetter(name, newValue) {
27
- this[name] = __returnValue.bind(null, newValue);
28
- }
29
- var __export = (target, all) => {
30
- for (var name in all)
31
- __defProp(target, name, {
32
- get: all[name],
33
- enumerable: true,
34
- configurable: true,
35
- set: __exportSetter.bind(all, name)
36
- });
37
- };
38
-
39
- // extra.js
40
- var exports_extra = {};
41
- __export(exports_extra, {
42
- tutuca: () => tutuca,
43
- test: () => test,
44
- macro: () => macro,
45
- isOMap: () => isOrderedMap,
46
- isIMap: () => isMap,
47
- injectCss: () => injectCss,
48
- html: () => html,
49
- css: () => css,
50
- component: () => component,
51
- compileClassesToStyleText: () => compileClassesToStyleText,
52
- compileClassesToStyle: () => compileClassesToStyle,
53
- collectIterBindings: () => collectIterBindings,
54
- check: () => check,
55
- SEQ_INFO: () => SEQ_INFO,
56
- ParseContext: () => ParseContext,
57
- OMap: () => OrderedMap2,
58
- KList: () => KList,
59
- ISet: () => Set2,
60
- IMap: () => Map2,
61
- FIELD_CLASS: () => FIELD_CLASS
62
- });
63
-
64
- // src/app.js
65
- var exports_app = {};
66
- __export(exports_app, {
67
- injectCss: () => injectCss,
68
- App: () => App
69
- });
70
-
71
- // src/components.js
72
- var exports_components = {};
73
- __export(exports_components, {
74
- DynamicAlias: () => DynamicAlias,
75
- Dynamic: () => Dynamic,
76
- Components: () => Components,
77
- ComponentStack: () => ComponentStack,
78
- Component: () => Component
79
- });
80
-
81
- // src/anode.js
82
- var exports_anode = {};
83
- __export(exports_anode, {
84
- compileModifiers: () => compileModifiers,
85
- WrapperNode: () => WrapperNode,
86
- View: () => View,
87
- TextNode: () => TextNode,
88
- SlotNode: () => SlotNode,
89
- ShowNode: () => ShowNode,
90
- ScopeNode: () => ScopeNode,
91
- RenderTextNode: () => RenderTextNode,
92
- RenderOnceNode: () => RenderOnceNode,
93
- RenderNode: () => RenderNode,
94
- RenderItNode: () => RenderItNode,
95
- RenderEachNode: () => RenderEachNode,
96
- PushViewNameNode: () => PushViewNameNode,
97
- ParseContext: () => ParseContext,
98
- NodeEvents: () => NodeEvents,
99
- MacroNode: () => MacroNode,
100
- Macro: () => Macro,
101
- MOD_WRAPPERS_BY_EVENT: () => MOD_WRAPPERS_BY_EVENT,
102
- IterInfo: () => IterInfo,
103
- HideNode: () => HideNode,
104
- FragmentNode: () => FragmentNode,
105
- EachNode: () => EachNode,
106
- DomNode: () => DomNode,
107
- CommentNode: () => CommentNode,
108
- BaseNode: () => BaseNode,
109
- ANode: () => ANode
110
- });
111
-
112
1
  // src/value.js
113
2
  import { is } from "immutable";
114
3
 
@@ -3338,11 +3227,6 @@ class DragInfo {
3338
3227
  }
3339
3228
 
3340
3229
  // src/util/parsectx.js
3341
- var exports_parsectx = {};
3342
- __export(exports_parsectx, {
3343
- collectAppClassesInSet: () => collectAppClassesInSet,
3344
- ParseCtxClassSetCollector: () => ParseCtxClassSetCollector
3345
- });
3346
3230
  class ParseCtxClassSetCollector extends ParseContext {
3347
3231
  constructor(...args) {
3348
3232
  super(...args);
@@ -3398,48 +3282,11 @@ class ParseCtxClassSetCollector extends ParseContext {
3398
3282
  return false;
3399
3283
  }
3400
3284
  }
3401
- function collectAppClassesInSet(app) {
3402
- const classes = new Set;
3403
- for (const Comp of app.comps.byId.values()) {
3404
- for (const key in Comp.views) {
3405
- const view = Comp.views[key];
3406
- for (const name of view.ctx.classes) {
3407
- classes.add(name);
3408
- }
3409
- }
3410
- }
3411
- return classes;
3412
- }
3413
3285
 
3414
3286
  // extra/klist.js
3415
- var exports_klist = {};
3416
- __export(exports_klist, {
3417
- KList: () => KList,
3418
- FieldKList: () => FieldKList
3419
- });
3420
3287
  import { Map as IMap2, List as List2 } from "immutable";
3421
3288
 
3422
3289
  // src/oo.js
3423
- var exports_oo = {};
3424
- __export(exports_oo, {
3425
- getTypeName: () => getTypeName,
3426
- fieldsByTypeName: () => fieldsByTypeName,
3427
- extendProtoForKeyed: () => extendProtoForKeyed,
3428
- component: () => component,
3429
- classFromData: () => classFromData,
3430
- FieldString: () => FieldString,
3431
- FieldSet: () => FieldSet,
3432
- FieldOMap: () => FieldOMap,
3433
- FieldMap: () => FieldMap,
3434
- FieldList: () => FieldList,
3435
- FieldInt: () => FieldInt,
3436
- FieldFloat: () => FieldFloat,
3437
- FieldComp: () => FieldComp,
3438
- FieldBool: () => FieldBool,
3439
- FieldAny: () => FieldAny,
3440
- Field: () => Field,
3441
- FIELD_CLASS: () => FIELD_CLASS
3442
- });
3443
3290
  import { Map as IMap, Set as ISet, List, OrderedMap, Record } from "immutable";
3444
3291
  var BAD_VALUE = Symbol("BadValue");
3445
3292
  var nullCoercer = (v) => v;
@@ -3823,15 +3670,6 @@ function classFromData(name, { fields = {}, methods, statics }) {
3823
3670
  var component = (opts) => new Component(classFromData(opts.name, opts), opts);
3824
3671
 
3825
3672
  // src/renderer.js
3826
- var exports_renderer = {};
3827
- __export(exports_renderer, {
3828
- unpackLoopResult: () => unpackLoopResult,
3829
- normalizeRange: () => normalizeRange,
3830
- getSeqInfo: () => getSeqInfo,
3831
- SEQ_INFO: () => SEQ_INFO,
3832
- Renderer: () => Renderer,
3833
- DATASET_ATTRS: () => DATASET_ATTRS
3834
- });
3835
3673
  import { isIndexed, isKeyed } from "immutable";
3836
3674
 
3837
3675
  // src/cache.js
@@ -4150,34 +3988,58 @@ KList.prototype[SEQ_INFO] = (seq, visit) => {
4150
3988
  visit(k, seq.items.get(k), "data-sk");
4151
3989
  };
4152
3990
  // index.js
4153
- var exports_tutuca = {};
4154
- __export(exports_tutuca, {
4155
- tutuca: () => tutuca,
4156
- test: () => test,
4157
- macro: () => macro,
4158
- isOMap: () => isOrderedMap,
4159
- isIMap: () => isMap,
4160
- injectCss: () => injectCss,
4161
- html: () => html,
4162
- css: () => css,
4163
- component: () => component,
4164
- collectIterBindings: () => collectIterBindings,
4165
- check: () => check,
4166
- SEQ_INFO: () => SEQ_INFO,
4167
- ParseContext: () => ParseContext,
4168
- OMap: () => OrderedMap2,
4169
- ISet: () => Set2,
4170
- IMap: () => Map2,
4171
- FIELD_CLASS: () => FIELD_CLASS
4172
- });
4173
- __reExport(exports_tutuca, immutable);
4174
- import"immutable";
4175
3991
  import {
4176
- isMap,
4177
- isOrderedMap,
3992
+ Collection,
3993
+ List as List3,
4178
3994
  Map as Map2,
4179
3995
  OrderedMap as OrderedMap2,
4180
- Set as Set2
3996
+ OrderedSet,
3997
+ PairSorting,
3998
+ Range,
3999
+ Record as Record2,
4000
+ Repeat,
4001
+ Seq,
4002
+ Set as Set2,
4003
+ Stack as Stack2,
4004
+ fromJS,
4005
+ get,
4006
+ getIn,
4007
+ has,
4008
+ hasIn,
4009
+ hash,
4010
+ is as is2,
4011
+ isAssociative,
4012
+ isCollection,
4013
+ isImmutable,
4014
+ isIndexed as isIndexed2,
4015
+ isKeyed as isKeyed2,
4016
+ isList,
4017
+ isMap,
4018
+ isOrdered,
4019
+ isOrderedMap,
4020
+ isOrderedSet,
4021
+ isPlainObject,
4022
+ isRecord,
4023
+ isSeq,
4024
+ isSet,
4025
+ isStack,
4026
+ isValueObject,
4027
+ merge,
4028
+ mergeDeep,
4029
+ mergeDeepWith,
4030
+ mergeWith,
4031
+ remove,
4032
+ removeIn,
4033
+ set,
4034
+ setIn,
4035
+ update,
4036
+ updateIn,
4037
+ version,
4038
+ isMap as isMap2,
4039
+ isOrderedMap as isOrderedMap2,
4040
+ Map as Map3,
4041
+ OrderedMap as OrderedMap3,
4042
+ Set as Set3
4181
4043
  } from "immutable";
4182
4044
  var css = String.raw;
4183
4045
  var html = String.raw;
@@ -4200,7 +4062,6 @@ function tutuca(nodeOrSelector) {
4200
4062
  }
4201
4063
 
4202
4064
  // extra.js
4203
- __reExport(exports_extra, exports_tutuca);
4204
4065
  async function compileClassesToStyle(app, compileClasses, styleId = "margaui-css") {
4205
4066
  const t1 = performance.now();
4206
4067
  const css2 = await compileClassesToStyleText(app, compileClasses);
@@ -4222,24 +4083,70 @@ async function compileClassesToStyleText(app, compileClasses, Ctx = ParseCtxClas
4222
4083
  return await compileClasses(Array.from(classes));
4223
4084
  }
4224
4085
  export {
4086
+ version,
4087
+ updateIn,
4088
+ update,
4225
4089
  tutuca,
4226
4090
  test,
4091
+ setIn,
4092
+ set,
4093
+ removeIn,
4094
+ remove,
4095
+ mergeWith,
4096
+ mergeDeepWith,
4097
+ mergeDeep,
4098
+ merge,
4227
4099
  macro,
4228
- isOrderedMap as isOMap,
4229
- isMap as isIMap,
4100
+ isValueObject,
4101
+ isStack,
4102
+ isSet,
4103
+ isSeq,
4104
+ isRecord,
4105
+ isPlainObject,
4106
+ isOrderedSet,
4107
+ isOrderedMap,
4108
+ isOrdered,
4109
+ isOrderedMap2 as isOMap,
4110
+ isMap,
4111
+ isList,
4112
+ isKeyed2 as isKeyed,
4113
+ isIndexed2 as isIndexed,
4114
+ isImmutable,
4115
+ isMap2 as isIMap,
4116
+ isCollection,
4117
+ isAssociative,
4118
+ is2 as is,
4230
4119
  injectCss,
4231
4120
  html,
4121
+ hash,
4122
+ hasIn,
4123
+ has,
4124
+ getIn,
4125
+ get,
4126
+ fromJS,
4232
4127
  css,
4233
4128
  component,
4234
4129
  compileClassesToStyleText,
4235
4130
  compileClassesToStyle,
4236
4131
  collectIterBindings,
4237
4132
  check,
4133
+ Stack2 as Stack,
4134
+ Set2 as Set,
4135
+ Seq,
4238
4136
  SEQ_INFO,
4137
+ Repeat,
4138
+ Record2 as Record,
4139
+ Range,
4239
4140
  ParseContext,
4240
- OrderedMap2 as OMap,
4141
+ PairSorting,
4142
+ OrderedSet,
4143
+ OrderedMap2 as OrderedMap,
4144
+ OrderedMap3 as OMap,
4145
+ Map2 as Map,
4146
+ List3 as List,
4241
4147
  KList,
4242
- Set2 as ISet,
4243
- Map2 as IMap,
4244
- FIELD_CLASS
4148
+ Set3 as ISet,
4149
+ Map3 as IMap,
4150
+ FIELD_CLASS,
4151
+ Collection
4245
4152
  };
@@ -3450,13 +3450,58 @@ var unkIter = () => {};
3450
3450
  var SEQ_INFO = Symbol.for("tutuca.seqInfo");
3451
3451
 
3452
3452
  // index.js
3453
- export * from "immutable";
3454
3453
  import {
3455
- isMap,
3456
- isOrderedMap,
3454
+ Collection,
3455
+ List as List2,
3457
3456
  Map as Map2,
3458
3457
  OrderedMap as OrderedMap2,
3459
- Set as Set2
3458
+ OrderedSet,
3459
+ PairSorting,
3460
+ Range,
3461
+ Record as Record2,
3462
+ Repeat,
3463
+ Seq,
3464
+ Set as Set2,
3465
+ Stack as Stack2,
3466
+ fromJS,
3467
+ get,
3468
+ getIn,
3469
+ has,
3470
+ hasIn,
3471
+ hash,
3472
+ is as is2,
3473
+ isAssociative,
3474
+ isCollection,
3475
+ isImmutable,
3476
+ isIndexed as isIndexed2,
3477
+ isKeyed as isKeyed2,
3478
+ isList,
3479
+ isMap,
3480
+ isOrdered,
3481
+ isOrderedMap,
3482
+ isOrderedSet,
3483
+ isPlainObject,
3484
+ isRecord,
3485
+ isSeq,
3486
+ isSet,
3487
+ isStack,
3488
+ isValueObject,
3489
+ merge,
3490
+ mergeDeep,
3491
+ mergeDeepWith,
3492
+ mergeWith,
3493
+ remove,
3494
+ removeIn,
3495
+ set,
3496
+ setIn,
3497
+ update,
3498
+ updateIn,
3499
+ version,
3500
+ isMap as isMap2,
3501
+ isOrderedMap as isOrderedMap2,
3502
+ Map as Map3,
3503
+ OrderedMap as OrderedMap3,
3504
+ Set as Set3
3460
3505
  } from "immutable";
3461
3506
 
3462
3507
  // src/oo.js
@@ -3863,21 +3908,67 @@ function tutuca(nodeOrSelector) {
3863
3908
  return new App(rootNode, comps, renderer, ParseContext);
3864
3909
  }
3865
3910
  export {
3911
+ version,
3912
+ updateIn,
3913
+ update,
3866
3914
  tutuca,
3867
3915
  test,
3916
+ setIn,
3917
+ set,
3918
+ removeIn,
3919
+ remove,
3920
+ mergeWith,
3921
+ mergeDeepWith,
3922
+ mergeDeep,
3923
+ merge,
3868
3924
  macro,
3869
- isOrderedMap as isOMap,
3870
- isMap as isIMap,
3925
+ isValueObject,
3926
+ isStack,
3927
+ isSet,
3928
+ isSeq,
3929
+ isRecord,
3930
+ isPlainObject,
3931
+ isOrderedSet,
3932
+ isOrderedMap,
3933
+ isOrdered,
3934
+ isOrderedMap2 as isOMap,
3935
+ isMap,
3936
+ isList,
3937
+ isKeyed2 as isKeyed,
3938
+ isIndexed2 as isIndexed,
3939
+ isImmutable,
3940
+ isMap2 as isIMap,
3941
+ isCollection,
3942
+ isAssociative,
3943
+ is2 as is,
3871
3944
  injectCss,
3872
3945
  html,
3946
+ hash,
3947
+ hasIn,
3948
+ has,
3949
+ getIn,
3950
+ get,
3951
+ fromJS,
3873
3952
  css,
3874
3953
  component,
3875
3954
  collectIterBindings,
3876
3955
  check,
3956
+ Stack2 as Stack,
3957
+ Set2 as Set,
3958
+ Seq,
3877
3959
  SEQ_INFO,
3960
+ Repeat,
3961
+ Record2 as Record,
3962
+ Range,
3878
3963
  ParseContext,
3879
- OrderedMap2 as OMap,
3880
- Set2 as ISet,
3881
- Map2 as IMap,
3882
- FIELD_CLASS
3964
+ PairSorting,
3965
+ OrderedSet,
3966
+ OrderedMap2 as OrderedMap,
3967
+ OrderedMap3 as OMap,
3968
+ Map2 as Map,
3969
+ List2 as List,
3970
+ Set3 as ISet,
3971
+ Map3 as IMap,
3972
+ FIELD_CLASS,
3973
+ Collection
3883
3974
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tutuca",
3
- "version": "0.9.71",
3
+ "version": "0.9.73",
4
4
  "type": "module",
5
5
  "description": "Zero-dependency SPA framework with immutable state and virtual DOM",
6
6
  "main": "./dist/tutuca.js",
@@ -13,6 +13,8 @@
13
13
  "./ext": "./dist/tutuca.ext.js",
14
14
  "./extra-ext": "./dist/tutuca-extra.ext.js",
15
15
  "./dev-ext": "./dist/tutuca-dev.ext.js",
16
+ "./immutable": "./dist/immutable.js",
17
+ "./chai": "./dist/chai.js",
16
18
  "./package.json": "./package.json"
17
19
  },
18
20
  "bin": {
@@ -23,7 +25,8 @@
23
25
  "dist": "bun scripts/dist.js",
24
26
  "dist-ext": "bun scripts/dist-ext.js",
25
27
  "dist-immutable": "bun scripts/dist-immutable.js",
26
- "dist-all": "bun run dist-immutable && bun run dist && bun run dist-ext",
28
+ "dist-all": "bun run dist-immutable && bun run dist && bun run dist-ext && bun run smoke",
29
+ "smoke": "node scripts/smoke.js",
27
30
  "release": "bun run dist-all && bun run build-skill && npm publish --access public",
28
31
  "release-dry": "bun run dist-all && bun run build-skill && npm publish --dry-run",
29
32
  "build-skill": "bun scripts/build-skill.js",
@@ -49,6 +52,8 @@
49
52
  "dist/tutuca.ext.js",
50
53
  "dist/tutuca-extra.ext.js",
51
54
  "dist/tutuca-dev.ext.js",
55
+ "dist/immutable.js",
56
+ "dist/chai.js",
52
57
  "skill"
53
58
  ],
54
59
  "dependencies": {
@@ -56,9 +61,13 @@
56
61
  "prettier": "^3.0.0"
57
62
  },
58
63
  "peerDependencies": {
64
+ "chai": "^6.2.2",
59
65
  "immutable": "*"
60
66
  },
61
67
  "peerDependenciesMeta": {
68
+ "chai": {
69
+ "optional": true
70
+ },
62
71
  "immutable": {
63
72
  "optional": true
64
73
  }
@@ -158,25 +158,25 @@ export function getTests({ describe, test, expect }) {
158
158
  describe("inc()", () => { // method
159
159
  test("returns a Counter with count + 1", () => {
160
160
  const next = Counter.make().inc();
161
- expect(next).to.be.instanceOf(Counter.Class);
162
- expect(next.count).to.equal(1);
161
+ expect(next).toBeInstanceOf(Counter.Class);
162
+ expect(next.count).toBe(1);
163
163
  });
164
164
  test("does not mutate the original instance", () => {
165
165
  const c = Counter.make({ count: 7 });
166
166
  c.inc();
167
- expect(c.count).to.equal(7); // immutability
167
+ expect(c.count).toBe(7); // immutability
168
168
  });
169
169
  });
170
170
 
171
171
  describe("dec()", () => { // input handler
172
172
  test("returns a Counter with count - 1", () => {
173
173
  const next = Counter.input.dec.call(Counter.make());
174
- expect(next.count).to.equal(-1);
174
+ expect(next.count).toBe(-1);
175
175
  });
176
176
  });
177
177
 
178
178
  test("inc and dec round-trip", () => { // untagged path
179
- expect(Counter.input.dec.call(Counter.make().inc()).count).to.equal(0);
179
+ expect(Counter.input.dec.call(Counter.make().inc()).count).toBe(0);
180
180
  });
181
181
  });
182
182
  }
@@ -514,6 +514,17 @@ input: { onPick(detail) { return this.setCurrent(detail.unicode); } }
514
514
  view: html`<emoji-picker @on.emoji-click="onPick value"></emoji-picker>`,
515
515
  ```
516
516
 
517
+ Handle these events declaratively with `@on.<event-name>` in the view —
518
+ don't grab the node from host/glue code and `addEventListener` on it. A
519
+ listener attached from outside the component runs outside the handler
520
+ model: no `return this.set…()`, no transactor batching, and the mutation
521
+ is invisible to the component that owns the state (the same hazard as
522
+ reaching into `app.state` directly). For any event with a real element in
523
+ the tree, `@on.` is the only entry point you need. Genuinely external
524
+ inbound sources (WebSocket, `postMessage`, timers) have no element to bind
525
+ — route those through `app.sendAtRoot` instead (see
526
+ [request-response.md](./request-response.md)).
527
+
517
528
  Pitfall: binding camelCase JS properties on a custom element silently
518
529
  fails. `:mapId=".id"` does *not* invoke a `set mapId` setter
519
530
  — the HTML parser lowercased the attribute name, so the framework assigns
@@ -16,13 +16,19 @@ A module opts into `tutuca test` by exporting `getTests`:
16
16
  export function getTests({ describe, test, expect }) {
17
17
  describe(MyComp, () => {
18
18
  test("does the thing", () => {
19
- expect(MyComp.make().doTheThing().count).to.equal(1);
19
+ expect(MyComp.make().doTheThing().count).toBe(1);
20
20
  });
21
21
  });
22
22
  }
23
23
  ```
24
24
 
25
- - `expect` is chai.
25
+ - `expect` is chai, extended with **jest-style matchers** (`toBe`,
26
+ `toEqual`, `toContain`, `toThrow`, `.not.toBe`, …) — the recommended
27
+ style. Chai's BDD chain (`expect(x).to.equal(1)`) still works for those
28
+ who prefer it. Run `tutuca help` for the full matcher list (it's
29
+ surfaced from code). Asymmetric/mock matchers
30
+ (`expect.objectContaining`, `toHaveBeenCalled…`, `toMatchSnapshot`) are
31
+ **not** available — tutuca has no mocking layer.
26
32
  - `test` and `describe` are **Tutuca's own** subset of the common
27
33
  Mocha/Bun-style API, injected by `tutuca test` — not Bun's built-ins.
28
34
  Available calls: `describe(title, fn)`, `describe(Component, fn)`,
@@ -147,7 +153,7 @@ test("filters and enriches", () => {
147
153
  when: "keepEven",
148
154
  enrichWith: "addLabel",
149
155
  });
150
- expect(r).to.deep.equal([
156
+ expect(r).toEqual([
151
157
  { key: 0, value: 10, label: "0/4: 10" },
152
158
  { key: 2, value: 30, label: "2/4: 30" },
153
159
  ]);
@@ -211,8 +217,8 @@ input: { setCount(n) { return this.setCount(n); } }
211
217
  At test time, the "good" forms become trivial:
212
218
 
213
219
  ```js
214
- expect(MyComp.make().setName("Ada").name).to.equal("Ada");
215
- expect(MyComp.input.setCount.call(MyComp.make(), 42).count).to.equal(42);
220
+ expect(MyComp.make().setName("Ada").name).toBe("Ada");
221
+ expect(MyComp.input.setCount.call(MyComp.make(), 42).count).toBe(42);
216
222
  ```
217
223
 
218
224
  The "bad" forms force every test to construct
@@ -237,31 +243,31 @@ export function getTests({ describe, test, expect }) {
237
243
  describe(Counter, () => {
238
244
  describe("inc()", () => { // method
239
245
  test("returns a Counter with count + 1", () => {
240
- expect(Counter.make().inc().count).to.equal(1);
246
+ expect(Counter.make().inc().count).toBe(1);
241
247
  });
242
248
  test("does not mutate the original instance", () => {
243
249
  const c = Counter.make({ count: 7 });
244
250
  c.inc();
245
- expect(c.count).to.equal(7);
251
+ expect(c.count).toBe(7);
246
252
  });
247
253
  });
248
254
 
249
255
  describe("dec()", () => { // input handler, no args
250
256
  test("returns a Counter with count - 1", () => {
251
257
  const next = Counter.input.dec.call(Counter.make());
252
- expect(next.count).to.equal(-1);
258
+ expect(next.count).toBe(-1);
253
259
  });
254
260
  });
255
261
 
256
262
  describe("setCount()", () => { // input handler, valueAsInt
257
263
  test("sets the count from a parsed int", () => {
258
264
  const next = Counter.input.setCount.call(Counter.make(), 42);
259
- expect(next.count).to.equal(42);
265
+ expect(next.count).toBe(42);
260
266
  });
261
267
  });
262
268
 
263
269
  test("inc and dec round-trip", () => { // untagged, inherits Counter
264
- expect(Counter.input.dec.call(Counter.make().inc()).count).to.equal(0);
270
+ expect(Counter.input.dec.call(Counter.make().inc()).count).toBe(0);
265
271
  });
266
272
  });
267
273
  }