# tests/core/predicates/token.predicate.test.ts

> 22 lines of code and 0 definitions.

Tree: Coordination tree
Language: typescript
Canonical: https://banes-lab.com/anatomy/coordination#file-coordination-tests-core-predicates-token-predicate-test-ts
Source text: https://banes-lab.com/assets/sources/source.8b193675ef644d8479571928ed1f1526f668384ffa5dad2465be4517e9eb6071.generated.txt

## Source

```typescript
import { accumulate, isWordCharacter } from "../../../tools/core/predicates/token.predicate.ts";
import { describe, it } from "node:test";
import assert from "node:assert/strict";

describe("isWordCharacter", () => {
    it("accepts letters, digits and the underscore", () => {
        assert.deepEqual(["a", "Z", "7", "_", "-", " ", ""].map(isWordCharacter), [
            true,
            true,
            true,
            true,
            false,
            false,
            false,
        ]);
    });
});

describe("accumulate", () => {
    it("collects the runs of characters the predicate accepts", () => {
        assert.deepEqual(accumulate("ab-cd  e", isWordCharacter), ["ab", "cd", "e"]);
        assert.deepEqual(accumulate("--", isWordCharacter), []);
    });
});
```
