Skip to content

Commit

Permalink
Merge branch 'main' into feature/navigation_changes_2
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwin-pc committed Jul 5, 2023
2 parents d49fcd3 + e07c5e6 commit e2be9ce
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 69 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Vis Colors] [Timeline] Replace `vis_type_timeline` colors with `ouiPaletteColorBlind()` ([#4366](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4366))
- [Vis Colors] Update legacy seed colors to use `ouiPaletteColorBlind()` ([#4348](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4348))
- [Vis colors] Update legacy mapped colors in charts plugin to use `ouiPaletteColorBlind()`, Update default color in legacy visualizations to use `ouiPaletteColorBlind()[0]` ([#4398](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4398))
- [Console] Migrate `/lib/mappings/` module to TypeScript ([#4008](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4008))

### 🔩 Tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* under the License.
*/

import { Field } from '../mappings';
import '../../../application/models/sense_editor/sense_editor.test.mocks';
import * as mappings from '../mappings';

Expand All @@ -39,7 +40,7 @@ describe('Mappings', () => {
mappings.clear();
});

function fc(f1, f2) {
function fc(f1: Field, f2: Field) {
if (f1.name < f2.name) {
return -1;
}
Expand All @@ -49,8 +50,8 @@ describe('Mappings', () => {
return 0;
}

function f(name, type) {
return { name: name, type: type || 'string' };
function f(name: string, type?: string) {
return { name, type: type || 'string' };
}

test('Multi fields 1.0 style', function () {
Expand Down Expand Up @@ -256,10 +257,37 @@ describe('Mappings', () => {
'test_index2',
]);
expect(mappings.getIndices(false).sort()).toEqual(['test_index1', 'test_index2']);
expect(mappings.expandAliases(['alias1', 'test_index2']).sort()).toEqual([
expect((mappings.expandAliases(['alias1', 'test_index2']) as string[]).sort()).toEqual([
'test_index1',
'test_index2',
]);
expect(mappings.expandAliases('alias2')).toEqual('test_index2');
});

test('Multi types', function () {
mappings.loadMappings({
index: {
properties: {
name1: {
type: 'object',
path: 'just_name',
properties: {
first1: { type: 'string' },
last1: { type: 'string', index_name: 'i_last_1' },
},
},
name2: {
type: 'object',
path: 'full',
properties: {
first2: { type: 'string' },
last2: { type: 'string', index_name: 'i_last_2' },
},
},
},
},
});

expect(mappings.getTypes()).toEqual(['properties']);
});
});
Loading

0 comments on commit e2be9ce

Please sign in to comment.