forked from MapComplete/MapComplete
More test cleanup
This commit is contained in:
parent
b67e108056
commit
3ab373f6ec
9 changed files with 179 additions and 370 deletions
41
tests/Logic/Tags/LazyMatching.spec.ts
Normal file
41
tests/Logic/Tags/LazyMatching.spec.ts
Normal 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;
|
||||
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue