Skip to content

Commit 3bff869

Browse files
committed
fixed test broken by merge
1 parent 76ab6c0 commit 3bff869

2 files changed

Lines changed: 19 additions & 20 deletions

File tree

src/core/server/saved_objects/service/lib/repository.test.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ describe('SavedObjectsRepository', () => {
555555
if_primary_term: mockVersionProps._primary_term,
556556
};
557557

558-
expectClientCallArgsAction([obj1WithSeq, obj2], { method: 'index' });
558+
expectClusterCallArgsAction([obj1WithSeq, obj2], { method: 'index' });
559559
});
560560

561561
it(`should use the ES create method if ID is defined and overwrite=false`, async () => {
@@ -1489,9 +1489,8 @@ describe('SavedObjectsRepository', () => {
14891489

14901490
it(`should use the ES index with version if ID and version are defined and overwrite=true`, async () => {
14911491
await createSuccess(type, attributes, { id, overwrite: true, version: mockVersion });
1492-
expect(client.index).toHaveBeenCalled();
1493-
1494-
expect(client.index.mock.calls[0][0]).toMatchObject({
1492+
expectClusterCalls('index');
1493+
expectClusterCallArgs({
14951494
if_seq_no: mockVersionProps._seq_no,
14961495
if_primary_term: mockVersionProps._primary_term,
14971496
});

src/core/server/saved_objects/service/lib/repository.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ export class SavedObjectsRepository {
137137
injectedConstructor: any = SavedObjectsRepository
138138
): ISavedObjectsRepository {
139139
const mappings = migrator.getActiveMappings();
140-
const allTypes = typeRegistry.getAllTypes().map(t => t.name);
140+
const allTypes = typeRegistry.getAllTypes().map((t) => t.name);
141141
const serializer = new SavedObjectsSerializer(typeRegistry);
142-
const visibleTypes = allTypes.filter(type => !typeRegistry.isHidden(type));
142+
const visibleTypes = allTypes.filter((type) => !typeRegistry.isHidden(type));
143143

144-
const missingTypeMappings = includedHiddenTypes.filter(type => !allTypes.includes(type));
144+
const missingTypeMappings = includedHiddenTypes.filter((type) => !allTypes.includes(type));
145145
if (missingTypeMappings.length > 0) {
146146
throw new Error(
147147
`Missing mappings for saved objects types: '${missingTypeMappings.join(', ')}'`
@@ -287,7 +287,7 @@ export class SavedObjectsRepository {
287287
const time = this._getCurrentTime();
288288

289289
let bulkGetRequestIndexCounter = 0;
290-
const expectedResults: Either[] = objects.map(object => {
290+
const expectedResults: Either[] = objects.map((object) => {
291291
if (!this._allowedTypes.includes(object.type)) {
292292
return {
293293
tag: 'Left' as 'Left',
@@ -334,7 +334,7 @@ export class SavedObjectsRepository {
334334

335335
let bulkRequestIndexCounter = 0;
336336
const bulkCreateParams: object[] = [];
337-
const expectedBulkResults: Either[] = expectedResults.map(expectedBulkGetResult => {
337+
const expectedBulkResults: Either[] = expectedResults.map((expectedBulkGetResult) => {
338338
if (isLeft(expectedBulkGetResult)) {
339339
return expectedBulkGetResult;
340340
}
@@ -412,7 +412,7 @@ export class SavedObjectsRepository {
412412
: undefined;
413413

414414
return {
415-
saved_objects: expectedBulkResults.map(expectedResult => {
415+
saved_objects: expectedBulkResults.map((expectedResult) => {
416416
if (isLeft(expectedResult)) {
417417
return expectedResult.error as any;
418418
}
@@ -464,7 +464,7 @@ export class SavedObjectsRepository {
464464
preflightResult = await this.preflightCheckIncludesNamespace(type, id, namespace);
465465
const existingNamespaces = getSavedObjectNamespaces(undefined, preflightResult);
466466
const remainingNamespaces = existingNamespaces?.filter(
467-
x => x !== getNamespaceString(namespace)
467+
(x) => x !== getNamespaceString(namespace)
468468
);
469469

470470
if (remainingNamespaces?.length) {
@@ -541,7 +541,7 @@ export class SavedObjectsRepository {
541541

542542
const { refresh = DEFAULT_REFRESH_SETTING } = options;
543543
const allTypes = Object.keys(getRootPropertiesObjects(this._mappings));
544-
const typesToUpdate = allTypes.filter(type => !this._registry.isNamespaceAgnostic(type));
544+
const typesToUpdate = allTypes.filter((type) => !this._registry.isNamespaceAgnostic(type));
545545

546546
const updateOptions = {
547547
index: this.getIndicesForTypes(typesToUpdate),
@@ -612,7 +612,7 @@ export class SavedObjectsRepository {
612612
}
613613

614614
const types = Array.isArray(type) ? type : [type];
615-
const allowedTypes = types.filter(t => this._allowedTypes.includes(t));
615+
const allowedTypes = types.filter((t) => this._allowedTypes.includes(t));
616616
if (allowedTypes.length === 0) {
617617
return {
618618
page,
@@ -719,7 +719,7 @@ export class SavedObjectsRepository {
719719
}
720720

721721
let bulkGetRequestIndexCounter = 0;
722-
const expectedBulkGetResults: Either[] = objects.map(object => {
722+
const expectedBulkGetResults: Either[] = objects.map((object) => {
723723
const { type, id, fields } = object;
724724

725725
if (!this._allowedTypes.includes(type)) {
@@ -761,7 +761,7 @@ export class SavedObjectsRepository {
761761
: undefined;
762762

763763
return {
764-
saved_objects: expectedBulkGetResults.map(expectedResult => {
764+
saved_objects: expectedBulkGetResults.map((expectedResult) => {
765765
if (isLeft(expectedResult)) {
766766
return expectedResult.error as any;
767767
}
@@ -1014,7 +1014,7 @@ export class SavedObjectsRepository {
10141014
const preflightResult = await this.preflightCheckIncludesNamespace(type, id, namespace);
10151015
const existingNamespaces = getSavedObjectNamespaces(undefined, preflightResult);
10161016
// if there are somehow no existing namespaces, allow the operation to proceed and delete this saved object
1017-
const remainingNamespaces = existingNamespaces?.filter(x => !namespaces.includes(x));
1017+
const remainingNamespaces = existingNamespaces?.filter((x) => !namespaces.includes(x));
10181018

10191019
if (remainingNamespaces?.length) {
10201020
// if there is 1 or more namespace remaining, update the saved object
@@ -1090,7 +1090,7 @@ export class SavedObjectsRepository {
10901090
const { namespace } = options;
10911091

10921092
let bulkGetRequestIndexCounter = 0;
1093-
const expectedBulkGetResults: Either[] = objects.map(object => {
1093+
const expectedBulkGetResults: Either[] = objects.map((object) => {
10941094
const { type, id } = object;
10951095

10961096
if (!this._allowedTypes.includes(type)) {
@@ -1146,7 +1146,7 @@ export class SavedObjectsRepository {
11461146
let bulkUpdateRequestIndexCounter = 0;
11471147
const bulkUpdateParams: object[] = [];
11481148
const expectedBulkUpdateResults: Either[] = expectedBulkGetResults.map(
1149-
expectedBulkGetResult => {
1149+
(expectedBulkGetResult) => {
11501150
if (isLeft(expectedBulkGetResult)) {
11511151
return expectedBulkGetResult;
11521152
}
@@ -1211,7 +1211,7 @@ export class SavedObjectsRepository {
12111211
: {};
12121212

12131213
return {
1214-
saved_objects: expectedBulkUpdateResults.map(expectedResult => {
1214+
saved_objects: expectedBulkUpdateResults.map((expectedResult) => {
12151215
if (isLeft(expectedResult)) {
12161216
return expectedResult.error as any;
12171217
}
@@ -1364,7 +1364,7 @@ export class SavedObjectsRepository {
13641364
* @param types The types whose indices should be retrieved
13651365
*/
13661366
private getIndicesForTypes(types: string[]) {
1367-
return unique(types.map(t => this.getIndexForType(t)));
1367+
return unique(types.map((t) => this.getIndexForType(t)));
13681368
}
13691369

13701370
private _getCurrentTime() {

0 commit comments

Comments
 (0)