mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-11-09 17:06:13 -06:00
feat(complex-matcher/Comparison): can match with non numbers
It will use implicit conversion.
This commit is contained in:
@@ -70,6 +70,7 @@
|
||||
- @xen-orchestra/rest-api minor
|
||||
- @xen-orchestra/web minor
|
||||
- @xen-orchestra/web-core minor
|
||||
- complex-matcher major
|
||||
- xo-server minor
|
||||
- xo-web minor
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class Comparison extends Node {
|
||||
}
|
||||
|
||||
match(value) {
|
||||
return typeof value === 'number' && this._comparator(value, this._value)
|
||||
return this._comparator(value, this._value)
|
||||
}
|
||||
|
||||
toString() {
|
||||
|
||||
@@ -76,6 +76,13 @@ describe('Comparison', () => {
|
||||
assert(new Comparison('<', 42).match(41))
|
||||
assert(new Comparison('<=', 42).match(42))
|
||||
})
|
||||
|
||||
it('can match with non numbers', () => {
|
||||
const ts = Date.now()
|
||||
|
||||
assert(new Comparison('>', ts).match(new Date(ts + 1)))
|
||||
assert(!new Comparison('>', ts).match(new Date(ts)))
|
||||
})
|
||||
})
|
||||
|
||||
describe('GlobPattern', () => {
|
||||
|
||||
Reference in New Issue
Block a user