Skip to content

Commit

Permalink
#38: add fixKey automation key-not-found test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Aug 3, 2023
1 parent e618054 commit 3b52840
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/type.automation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,41 @@ describe('type: automation', () => {
return;
});
});
describe('FixKeys ================', () => {
beforeEach(() => {
testUtils.mockSetup(true);
});
it('Should run fixKeys but not find fixable keys and hence stop', async () => {
// WHEN
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false } });
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'automation', [
'testExisting_automation',
]);
// THEN
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
// check which keys were fixed
assert.equal(
resultFixKeys['testInstance/testBU'].length,
0,
'expected to find no keys to be fixed'
);

// get results from cache
const result = cache.getCache();
assert.equal(
result.automation ? Object.keys(result.automation).length : 0,
1,
'one automation expected'
);
// check number of API calls
assert.equal(
testUtils.getAPIHistoryLength(),
14,
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
);
return;
});
});
describe('Templating ================', () => {
it('Should create a automation template via retrieveAsTemplate and build it', async () => {
// GIVEN there is a template
Expand Down

0 comments on commit 3b52840

Please sign in to comment.