From 418e52575a287baa7e03868768bdd010c7abc4b2 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 24 May 2023 00:26:57 +0200 Subject: [PATCH] Tests: add regression test for regex --- test/Logic/Tags/TagUtils.spec.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/Logic/Tags/TagUtils.spec.ts b/test/Logic/Tags/TagUtils.spec.ts index f0debd559..99f690d0f 100644 --- a/test/Logic/Tags/TagUtils.spec.ts +++ b/test/Logic/Tags/TagUtils.spec.ts @@ -1,6 +1,6 @@ -import { TagUtils } from "../../../Logic/Tags/TagUtils" -import { equal } from "assert" -import { describe, expect, it } from "vitest" +import {TagUtils} from "../../../Logic/Tags/TagUtils" +import {equal} from "assert" +import {describe, expect, it} from "vitest" describe("TagUtils", () => { describe("ParseTag", () => { @@ -45,4 +45,13 @@ describe("TagUtils", () => { expect(filter.matchesProperties({ date_created: "2022-01-01" })).toBe(true) }) }) + describe("regextag", () => { + it("should match tags", () => { + const t = TagUtils.Tag( "_tags~(^|.*;)leisure=picnic_table($|;.*)") + const properties = { + _tags: 'leisure=picnic_table' + } + expect(t.matchesProperties(properties)).toBe(true) + }) + }) })