Skip to content

Commit

Permalink
chore: use start-activity for api level 26+ (#771)
Browse files Browse the repository at this point in the history
* chore: use start-activity for api level 26+

* add test
  • Loading branch information
KazuCocoa authored Nov 9, 2024
1 parent 74fb4f0 commit 8faa1f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ function buildStartCmd (startAppOptions, apiLevel) {
stopApp,
flags,
} = startAppOptions;
const cmd = ['am', 'start'];
const cmd = ['am', (apiLevel < 26) ? 'start' : 'start-activity'];
if (util.hasValue(user)) {
cmd.push('--user', user);
}
Expand Down
8 changes: 8 additions & 0 deletions test/unit/helper-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ describe('helpers', withMocks({fs}, function (mocks) {
activity: '.SomeActivity'
};

it('should use start', function () {
let cmd = buildStartCmd(startOptions, 20);
cmd[1].should.eql('start');
});
it('should use start-activity', function () {
let cmd = buildStartCmd(startOptions, 26);
cmd[1].should.eql('start-activity');
});
it('should parse optionalIntentArguments with single key', function () {
let cmd = buildStartCmd(_.defaults({optionalIntentArguments: '-d key'}, startOptions), 20);
cmd[cmd.length - 2].should.eql('-d');
Expand Down

0 comments on commit 8faa1f3

Please sign in to comment.