mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Fleet] Add unit test for mapping generation (#141795)
This commit is contained in:
parent
249b596465
commit
c9d9d63ee7
1 changed files with 50 additions and 0 deletions
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||||
|
* or more contributor license agreements. Licensed under the Elastic License
|
||||||
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||||
|
* 2.0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { keyword } from './mappings';
|
||||||
|
|
||||||
|
describe('mappings', () => {
|
||||||
|
describe('keyword', () => {
|
||||||
|
it('should set ignore_above:1024 by default for indexed field', () => {
|
||||||
|
const mappings = keyword({
|
||||||
|
name: 'test',
|
||||||
|
type: 'keyword',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(mappings).toEqual({
|
||||||
|
ignore_above: 1024,
|
||||||
|
type: 'keyword',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not set ignore_above for non indexed field', () => {
|
||||||
|
const mappings = keyword({
|
||||||
|
name: 'test',
|
||||||
|
type: 'keyword',
|
||||||
|
index: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(mappings).toEqual({
|
||||||
|
type: 'keyword',
|
||||||
|
index: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not set ignore_above field with doc_values:false', () => {
|
||||||
|
const mappings = keyword({
|
||||||
|
name: 'test',
|
||||||
|
type: 'keyword',
|
||||||
|
doc_values: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(mappings).toEqual({
|
||||||
|
type: 'keyword',
|
||||||
|
doc_values: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue