Botanique/tests/utils/regex.test.ts
Mylloon a790ddf377
All checks were successful
Publish latest version / build (push) Successful in 2m11s
tests: use node:test (#210)
Close #201

Tests run much faster and we don't need as much as libs

Reviewed-on: #210
Co-authored-by: Mylloon <kennel.anri@tutanota.com>
Co-committed-by: Mylloon <kennel.anri@tutanota.com>
2024-12-14 11:43:09 +01:00

29 lines
849 B
TypeScript

import { RegexC, RegExpFlags } from "../../src/utils/regex";
import { describe, it } from "node:test";
import assert from "node:assert/strict";
describe("Regex flags", () => {
it("One parameter", () => {
const regex = RegexC("", RegExpFlags.Global);
assert.strictEqual(regex.global, true);
});
it("All parameters", () => {
const regex = RegexC(
"",
RegExpFlags.Global |
RegExpFlags.MultiLine |
RegExpFlags.Insensitive |
RegExpFlags.Sticky |
RegExpFlags.Unicode |
RegExpFlags.SingleLine,
);
assert.strictEqual(regex.global, true);
assert.strictEqual(regex.multiline, true);
assert.strictEqual(regex.ignoreCase, true);
assert.strictEqual(regex.sticky, true);
assert.strictEqual(regex.unicode, true);
assert.strictEqual(regex.dotAll, true);
});
});