Skip to content

Commit

Permalink
tests: test getIncomatibleEngines
Browse files Browse the repository at this point in the history
  • Loading branch information
jarekdanielak committed Dec 11, 2024
1 parent 36cf7a5 commit 54da72d
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions test/spec/cloud-element-templates/ElementTemplates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,82 @@ describe('provider/cloud-element-templates - ElementTemplates', function() {
}));
});

describe('getIncompatibleEngines', function() {

it('should return incompatible engine', inject(function(elementTemplates) {

// given
elementTemplates.setEngines({
camunda: '8.5'
});

const template = {
engines: {
camunda: '8.6'
}
};

// then
const result = elementTemplates.getIncompatibleEngines(template);
const length = Object.keys(result).length;

expect(length).to.be.equal(1);

expect(result).to.have.nested.property('camunda.localVersion', '8.5.0');
expect(result).to.have.nested.property('camunda.templateVersion', '8.6');
}));


it('should return multiple', inject(function(elementTemplates) {

// given
elementTemplates.setEngines({
camunda: '8.5',
desktopModeler: '5.30'
});

const template = {
engines: {
camunda: '8.6',
desktopModeler: '5.4'
}
};

// then
const result = elementTemplates.getIncompatibleEngines(template);
const length = Object.keys(result).length;

expect(length).to.be.equal(2);

expect(result).to.have.nested.property('camunda.localVersion', '8.5.0');
expect(result).to.have.nested.property('camunda.templateVersion', '8.6');

expect(result).to.have.nested.property('desktopModeler.localVersion', '5.30.0');
expect(result).to.have.nested.property('desktopModeler.templateVersion', '5.4');
}));


it('should return empty object if compatible', inject(function(elementTemplates) {

// given
elementTemplates.setEngines({
nonMatchingEngine: '8.5'
});

const template = {
engines: {
camunda: '8.5',
}
};

// then
const result = elementTemplates.getIncompatibleEngines(template);

expect(result).to.be.empty;
}));

});

});

describe('error handling on instantiation', function() {
Expand Down Expand Up @@ -1510,6 +1586,8 @@ describe('error handling on instantiation', function() {
});




describe('provider/cloud-element-templates - ElementTemplates - integration', function() {

let container;
Expand Down

0 comments on commit 54da72d

Please sign in to comment.