« get me outta code hell

Revert "contract: BlackBox stub & NormalizedArrayMap" - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-05-25 08:54:27 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-05-25 08:54:27 -0300
commit403c63afd7a9cc7ec2995d5200a6df8527fa3558 (patch)
tree224ee910247a3b2ca3336e97c52101daf36866bb /test
parent86e8b47b5aeeae5f2fc3b87bb5930fb4c25f88ab (diff)
Revert "contract: BlackBox stub & NormalizedArrayMap"
This reverts commit 86e8b47b5aeeae5f2fc3b87bb5930fb4c25f88ab.
Diffstat (limited to 'test')
-rw-r--r--test/unit/contract/black-box.js81
1 files changed, 0 insertions, 81 deletions
diff --git a/test/unit/contract/black-box.js b/test/unit/contract/black-box.js
deleted file mode 100644
index 21c05b52..00000000
--- a/test/unit/contract/black-box.js
+++ /dev/null
@@ -1,81 +0,0 @@
-import {BlackBox} from '../../../src/contract.js';
-import {mockFunction} from '../../lib/generic-mock.js';
-import {showAggregate} from '../../../src/util/sugar.js';
-
-import t from 'tap';
-
-t.test(`BlackBox - caching`, t => {
-  t.plan(8);
-
-  const obj1 = {foo: 3, bar: 4};
-  const obj2 = {baz: 5, qux: 6};
-
-  let {value: fn, close: closeMock} =
-    mockFunction((object, key) => object[key] ** 2)
-
-  fn = fn
-    .args([obj1, 'foo']).next()
-    .args([obj2, 'qux']).next()
-    .args([obj1, 'bar']).next()
-    .args([obj2, 'baz']);
-
-  const bb = new BlackBox(fn);
-  const evaluate = bb.getEvaluator();
-
-  t.equal(evaluate(obj1, 'foo'), 3 ** 2);
-  t.equal(evaluate(obj1, 'foo'), 3 ** 2);
-  t.equal(evaluate(obj2, 'qux'), 6 ** 2);
-  t.equal(evaluate(obj2, 'qux'), 6 ** 2);
-  t.equal(evaluate(obj1, 'foo'), 3 ** 2);
-
-  t.equal(evaluate(obj1, 'bar'), 4 ** 2);
-  t.equal(evaluate(obj2, 'baz'), 5 ** 2);
-  t.equal(evaluate(obj1, 'foo'), 3 ** 2);
-
-  try {
-    closeMock();
-  } catch (error) {
-    showAggregate(error);
-    throw error;
-  }
-});
-
-t.test(`BlackBox - no caching`, t => {
-  t.plan(8);
-
-  const obj1 = {foo: 3, bar: 4};
-  const obj2 = {baz: 5, qux: 6};
-
-  let {value: fn, close: closeMock} =
-    mockFunction((object, key) => object[key] ** 2)
-
-  fn = fn
-    .args([obj1, 'foo']).repeat(2)
-    .args([obj2, 'qux']).repeat(2)
-    .args([obj1, 'foo']).next()
-    .args([obj1, 'bar']).next()
-    .args([obj2, 'baz']).next()
-    .args([obj1, 'foo']);
-
-  const bb = new BlackBox(fn);
-  const evaluate = bb.getEvaluator();
-
-  bb.caching = false;
-
-  t.equal(evaluate(obj1, 'foo'), 3 ** 2);
-  t.equal(evaluate(obj1, 'foo'), 3 ** 2);
-  t.equal(evaluate(obj2, 'qux'), 6 ** 2);
-  t.equal(evaluate(obj2, 'qux'), 6 ** 2);
-  t.equal(evaluate(obj1, 'foo'), 3 ** 2);
-
-  t.equal(evaluate(obj1, 'bar'), 4 ** 2);
-  t.equal(evaluate(obj2, 'baz'), 5 ** 2);
-  t.equal(evaluate(obj1, 'foo'), 3 ** 2);
-
-  try {
-    closeMock();
-  } catch (error) {
-    showAggregate(error);
-    throw error;
-  }
-});