Updated test

This commit is contained in:
delvedor
2020-09-03 17:37:49 +02:00
parent 7f0e56b444
commit 917cb534b1
3 changed files with 109 additions and 1 deletions

View File

@ -0,0 +1,62 @@
'use strict'
import { test } from 'tap'
/* eslint-disable no-unused-vars */
import * as types from '../../dsl/lib/types'
/* eslint-enable no-unused-vars */
import { F } from '../../dsl'
test('match', t => {
t.deepEqual(new F()
.match('foo', 'bar')
.match('foo', 'baz')
.build(), {
query: {
bool: {
must: [
{ match: { foo: 'bar' } },
{ match: { foo: 'baz' } }
]
}
}
})
t.deepEqual(new F()
.match('foo', ['bar', 'baz'])
.build(), {
query: {
bool: {
must: [
{ match: { foo: 'bar' } },
{ match: { foo: 'baz' } }
]
}
}
})
t.end()
})
test('matchPhrase', t => {
t.deepEqual(new F()
.matchPhrase('foo', 'bar')
.build(), {
query: {
match_phrase: { foo: 'bar' },
}
})
t.end()
})
test('matchPhrasePrefix', t => {
t.deepEqual(new F()
.matchPhrasePrefix('foo', 'bar')
.build(), {
query: {
match_phrase_prefix: { foo: 'bar' },
}
})
t.end()
})