forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid calculating hash of all index pattern properties (elastic#184292)
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/plugins/kibana_utils/common/calculate_object_hash.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,24 @@ | ||
/* | ||
* 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 { calculateObjectHash } from './calculate_object_hash'; | ||
|
||
describe('calculateObjectHash', () => { | ||
test('calculates hash of the object', () => { | ||
const object = { test: 123 }; | ||
|
||
expect(calculateObjectHash(object)).toEqual('5094c3dc'); | ||
}); | ||
|
||
test('ignore inner props of index object expect for the value.id', () => { | ||
const object1 = { test: 123, index: { value: { id: 'test', otherprop: 1 } } }; | ||
const object2 = { test: 123, index: { value: { id: 'test', otherprop: 2 } } }; | ||
|
||
expect(calculateObjectHash(object1)).toEqual(calculateObjectHash(object2)); | ||
}); | ||
}); |
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