with one click
write-tests
// Write or update tests for a module or feature. Use when asked to write tests, add test coverage, or verify functionality for deep6.
// Write or update tests for a module or feature. Use when asked to write tests, add test coverage, or verify functionality for deep6.
Use the deep6 library for deep equality, deep cloning, unification, and pattern matching with logical variables in a JavaScript/TypeScript project. Use when adding structural comparison, structured clone with circular references, extensible pattern matching with extraction, or unification-based logic to a project that depends on `deep6`.
Add support for a new type to unify and clone registries. Use when asked to support a new JavaScript type or custom class in deep6.
Add a new unifier module to deep6. Use when asked to create custom pattern matching logic or extend unification behavior.
Debug unification failures in deep6. Use when unification returns null or produces unexpected results.
| name | write-tests |
| description | Write or update tests for a module or feature. Use when asked to write tests, add test coverage, or verify functionality for deep6. |
Write or update tests for the deep6 library.
tests/test-env.js โ Env class, Variable, aliases, push/pop/reverttests/test-unify.js โ Core unification (primitives, arrays, objects, variables, circular, flags)tests/test-match.js โ Pattern matching (open, soft, preprocess)tests/test-registry.js โ Type registries (Date, RegExp, typed arrays, Set, Map, filters)tests/test-unifiers.js โ matchString, matchTypeOf, matchInstanceOf, matchCondition, reftests/test-traverse.js โ walk, clone, assemble, dereftests/test-index.js โ Main API (equal, match, clone, isShape), replaceVarsnpm testTests use a custom harness in tests/harness.js. Each test file imports submit and TEST, exports a default array of test functions:
import unify from '../src/unify.js';
import {submit, TEST} from './harness.js';
export default [
function test_my_feature() {
eval(TEST('unify(1, 1)'));
eval(TEST('!unify(1, 2)'));
let result = unify({a: 1}, {a: 1});
eval(TEST('result'));
}
];
import {equal} from '../src/index.js';{submit, TEST} from ./harness.js.eval(TEST('expression')) for assertions โ the expression is both the test and the message.test_descriptive_name.