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

> 22 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-coordination-core-predicates-token-predicate-test-ts
Source text: https://banes-lab.com/source/testing/test.coordination/core/predicates/token.predicate.test.ts.txt

Listed in [test.coordination/core/predicates](https://banes-lab.com/api/source/testing/test.coordination/core/predicates.md), after [test.coordination/core/predicates/text.predicate.test.ts](https://banes-lab.com/source/testing/test.coordination/core/predicates/text.predicate.test.ts.md).

## Contained in

- [test.coordination/core/predicates](https://banes-lab.com/anatomy/testing/folder-testing-test-coordination-core-predicates.md)

## Source

```typescript
import { accumulate, isWordCharacter } from "coordination-surface/tools/core/predicates/token.predicate.ts";
import { describe, it } from "vitest";
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), []);
    });
});
```
