Tests: add regression test for regex

This commit is contained in:
Pieter Vander Vennet 2023-05-24 00:26:57 +02:00
parent 84cbd2fbc0
commit 418e52575a

View file

@ -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)
})
})
})