More test cleanup

This commit is contained in:
Pieter Vander Vennet 2022-03-21 02:00:50 +01:00
parent b67e108056
commit 3ab373f6ec
9 changed files with 179 additions and 370 deletions

View file

@ -0,0 +1,41 @@
import {describe} from 'mocha'
import {expect} from 'chai'
import {TagUtils} from "../../../Logic/Tags/TagUtils";
import T from "../../../testLegacy/TestHelper";
import {Tag} from "../../../Logic/Tags/Tag";
describe("Lazy object properties", () => {
it("should be matche by a normal tag", () => {
const properties = {}
const key = "_key"
Object.defineProperty(properties, key, {
configurable: true,
get: function () {
delete properties[key]
properties[key] = "yes"
return "yes"
}
})
const filter = new Tag("_key", "yes")
expect(filter.matchesProperties(properties)).true
})
it("should be matched by a RegexTag", () => {
const properties = {}
const key = "_key"
Object.defineProperty(properties, key, {
configurable: true,
get: function () {
delete properties[key]
properties[key] = "yes"
return "yes"
}
})
const filter = TagUtils.Tag("_key~*")
expect(filter.matchesProperties(properties)).true;
})
})