Skip to content

Commit

Permalink
Reverted changes on template
Browse files Browse the repository at this point in the history
  • Loading branch information
grafitto committed Feb 16, 2022
1 parent 36234d8 commit 047b703
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
44 changes: 0 additions & 44 deletions app/api/templates/specs/templates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import fixtures, {
relatedTo,
thesauriId1,
thesauriId2,
pageSharedId,
} from './fixtures/fixtures.js';

describe('templates', () => {
Expand Down Expand Up @@ -274,49 +273,6 @@ describe('templates', () => {
expect(newDoc.properties).toEqual([]);
});

it('should not update metadata properties if entityViewPage changes', async () => {
spyOn(entities, 'updateMetadataProperties').and.returnValue(Promise.resolve());
const newTemplate = {
name: 'created_template',
commonProperties: [{ name: 'title', label: 'Title', type: 'text' }],
};
await templates.save(newTemplate);
const allTemplates = await templates.get();
const newDoc = allTemplates.find(template => template.name === 'created_template');
newDoc.entityViewPage = pageSharedId;
await templates.save(newDoc, 'en', false);
expect(entities.updateMetadataProperties).not.toHaveBeenCalled();
});

it('should not update metadata properties if media fullWidth changes', async () => {
spyOn(entities, 'updateMetadataProperties').and.returnValue(Promise.resolve());
const newTemplate = {
name: 'created_template',
commonProperties: [{ name: 'title', label: 'Title', type: 'text' }],
properties: [{ name: 'media', label: 'media', type: 'media', fullWidth: true }],
};
await templates.save(newTemplate);
const allTemplates = await templates.get();
const newDoc = allTemplates.find(template => template.name === 'created_template');
newDoc.properties[0].fullWidth = false;
await templates.save(newDoc, 'en', false);
expect(entities.updateMetadataProperties).not.toHaveBeenCalled();
});

it('should update metadata properties if properties/commonProperties changes', async () => {
spyOn(entities, 'updateMetadataProperties').and.returnValue(Promise.resolve());
const newTemplate = {
name: 'created_template',
commonProperties: [{ name: 'title', label: 'Title', type: 'text' }],
};
await templates.save(newTemplate);
const allTemplates = await templates.get();
const newDoc = allTemplates.find(template => template.name === 'created_template');
newDoc.commonProperties[0].label = 'new label';
await templates.save(newDoc, 'en', false);
expect(entities.updateMetadataProperties).toHaveBeenCalled();
});

describe('when passing _id', () => {
beforeEach(() => {
spyOn(entities, 'updateMetadataProperties').and.returnValue(Promise.resolve());
Expand Down
1 change: 0 additions & 1 deletion app/api/templates/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export default {
await updateExtractedMetadataProperties(currentTemplate.properties, template.properties);
const generatedIdAdded = await checkAndFillGeneratedIdProperties(currentTemplate, template);
const savedTemplate = model.save(template);

await entities.updateMetadataProperties(template, currentTemplate, language, {
reindex,
generatedIdAdded,
Expand Down

0 comments on commit 047b703

Please sign in to comment.