Skip to content

Commit

Permalink
rename some test parameters
Browse files Browse the repository at this point in the history
Signed-off-by: yujin-emma <[email protected]>
  • Loading branch information
yujin-emma committed Feb 6, 2024
1 parent 8b1a3f4 commit 336b111
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ export async function checkConflictsForDataSource({
} = object;
const { destinationId } = retryMap.get(`${type}:${id}`) || {};

if (!object.type.includes('data-source')) {
// check the previous data source existed or not
// by extract it from the id
// e.g. e0c9e490-bdd7-11ee-b216-d78a57002330_ff959d40-b880-11e8-a6d9-e546fe2bba5f
// e0c9e490-bdd7-11ee-b216-d78a57002330 is the data source id
// for saved object data source itself, e0c9e490-bdd7-11ee-b216-d78a57002330 return undefined
if (object.type !== 'data-source') {
const parts = id.split('_'); // this is the array to host the split results of the id
const previoudDataSourceId = parts.length > 1 ? parts[0] : undefined;
/**
Expand Down
30 changes: 15 additions & 15 deletions src/core/server/saved_objects/import/import_saved_objects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,11 @@ describe('#importSavedObjectsFromStream', () => {
const error1 = createError();
const error2 = createError();
// add some objects with data source id
const dsObj1 = createObject(testDataSourceId);
const dataSourceObj1 = createObject(testDataSourceId);
const tmp2 = createObject(testDataSourceId);
const dsObj2 = { ...tmp2, destinationId: 'some-destinationId', originId: tmp.id };
const dsObj3 = { ...createObject(testDataSourceId), destinationId: 'another-destinationId' };
const createdDsObjects = [dsObj1, dsObj2, dsObj3];
const dataSourceObj2 = { ...tmp2, destinationId: 'some-destinationId', originId: tmp.id };
const dataSourceObj3 = { ...createObject(testDataSourceId), destinationId: 'another-destinationId' };

Check failure on line 395 in src/core/server/saved_objects/import/import_saved_objects.test.ts

View workflow job for this annotation

GitHub Actions / Build and Verify on Linux (ciGroup1)

Replace `·...createObject(testDataSourceId),·destinationId:·'another-destinationId'` with `⏎········...createObject(testDataSourceId),⏎········destinationId:·'another-destinationId',⏎·····`
const createdDsObjects = [dataSourceObj1, dataSourceObj2, dataSourceObj3];

// results
const success1 = {
Expand All @@ -416,23 +416,23 @@ describe('#importSavedObjectsFromStream', () => {
const errors = [error1, error2];

const dsSuccess1 = {
type: dsObj1.type,
id: dsObj1.id,
meta: { title: dsObj1.attributes.title, icon: `${dsObj1.type}-icon` },
type: dataSourceObj1.type,
id: dataSourceObj1.id,
meta: { title: dataSourceObj1.attributes.title, icon: `${dataSourceObj1.type}-icon` },
};

const dsSuccess2 = {
type: dsObj2.type,
id: dsObj2.id,
meta: { title: dsObj2.attributes.title, icon: `${dsObj2.type}-icon` },
destinationId: dsObj2.destinationId,
type: dataSourceObj2.type,
id: dataSourceObj2.id,
meta: { title: dataSourceObj2.attributes.title, icon: `${dataSourceObj2.type}-icon` },
destinationId: dataSourceObj2.destinationId,
};

const dsSuccess3 = {
type: dsObj3.type,
id: dsObj3.id,
meta: { title: dsObj3.attributes.title, icon: `${dsObj3.type}-icon` },
destinationId: dsObj3.destinationId,
type: dataSourceObj3.type,
id: dataSourceObj3.id,
meta: { title: dataSourceObj3.attributes.title, icon: `${dataSourceObj3.type}-icon` },
destinationId: dataSourceObj3.destinationId,
};

test('with createNewCopies disabled', async () => {
Expand Down

0 comments on commit 336b111

Please sign in to comment.