Skip to content

Commit

Permalink
fix oputput since logic_triggers was changed for triggers into the lf…
Browse files Browse the repository at this point in the history
… class
  • Loading branch information
hugomontero committed Dec 21, 2023
1 parent da1cc9e commit ab88b25
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cmd/logic-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = class LogicFunctionsCommand extends CLICommandBase {
// We assume at least one trigger
this.ui.stdout.write(`- ${item.name} (${item.enabled ? this.ui.chalk.cyanBright('enabled') : this.ui.chalk.cyan('disabled')})${os.EOL}`);
this.ui.stdout.write(` - ID: ${item.id}${os.EOL}`);
this.ui.stdout.write(` - ${item.logic_triggers[0].type} based trigger ${os.EOL}`);
this.ui.stdout.write(` - ${item.triggers[0].type} based trigger ${os.EOL}`);
});
this.ui.stdout.write(`${os.EOL}To view a Logic Function's code, see ${this.ui.chalk.yellow('particle logic-function get')}.${os.EOL}`);
}
Expand Down
7 changes: 7 additions & 0 deletions src/cmd/logic-function.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ describe('LogicFunctionCommands', () => {
});

describe('list', () => {
beforeEach(() => {
logicFunc1.logic_functions.forEach((lf) => {
lf.triggers = lf.logic_triggers;
});
});

it('lists logic functions in Sandbox account', async () => {

const logicListStub = sinon.stub(LogicFunction, 'listFromCloud').resolves(logicFunc1.logic_functions);
await logicFunctionCommands.list({});
expect(logicListStub.calledWith({ api: logicFunctionCommands.api, org: undefined })).to.be.true;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/logic-function.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('LogicFunction', () => {
nock.cleanAll();
fs.emptyDirSync(PATH_TMP_DIR);
});
describe('list', () => {
describe('list', () => {
it('returns an empty array if there are no logic functions', async () => {
nock('https://api.particle.io/v1/', )
.intercept('/logic/functions', 'GET')
Expand Down

0 comments on commit ab88b25

Please sign in to comment.