-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover] Fixed tooltips for text and keyword fields displaying 'Unk…
…nown field' in expanded document (#133536) * [Discover] Fixed tooltips for text and keyword fields displaying 'Unknown field' * [Discover] Added tests for getFieldTypeName function * [Discover] Fixing issue where i18n defaultMessage was a variable instead of a constant string Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
5d32987
commit 3e3ee3e
Showing
5 changed files
with
77 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
src/plugins/discover/public/components/field_name/field_type_name.ts
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
src/plugins/discover/public/utils/get_field_type_name.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { | ||
getFieldTypeName, | ||
KNOWN_FIELD_TYPES, | ||
UNKNOWN_FIELD_TYPE_MESSAGE, | ||
} from './get_field_type_name'; | ||
|
||
describe('getFieldTypeName', () => { | ||
describe('known field types should be recognized', () => { | ||
it.each(Object.values(KNOWN_FIELD_TYPES))( | ||
`'%s' should return a string that does not match '${UNKNOWN_FIELD_TYPE_MESSAGE}'`, | ||
(field) => { | ||
const fieldTypeName = getFieldTypeName(field); | ||
expect(typeof fieldTypeName).toBe('string'); | ||
expect(fieldTypeName).not.toBe(UNKNOWN_FIELD_TYPE_MESSAGE); | ||
} | ||
); | ||
}); | ||
|
||
it(`should return '${UNKNOWN_FIELD_TYPE_MESSAGE}' when passed undefined`, () => { | ||
expect(getFieldTypeName(undefined)).toBe(UNKNOWN_FIELD_TYPE_MESSAGE); | ||
}); | ||
|
||
it(`should return '${UNKNOWN_FIELD_TYPE_MESSAGE}' when passed an unknown field type`, () => { | ||
expect(getFieldTypeName('unknown_field_type')).toBe(UNKNOWN_FIELD_TYPE_MESSAGE); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters