Skip to content

Commit

Permalink
test: monitor --all-sub-projects with multiple targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Yegupov committed Apr 8, 2019
1 parent d12167d commit 4b7b430
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/acceptance/cli.acceptance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2342,6 +2342,47 @@ test('`monitor gradle-app --all-sub-projects`', async (t) => {
}], 'calls gradle plugin');
});

test('`monitor gradle-app pip-app --all-sub-projects`', async (t) => {
t.plan(7);
chdirWorkspaces();
const plugin = {
async inspect() {
return {
plugin: {},
package: {},
};
},
};
const spyPlugin = sinon.spy(plugin, 'inspect');
const loadPlugin = sinon.stub(plugins, 'loadPlugin');
t.teardown(loadPlugin.restore);
loadPlugin.withArgs('gradle').returns(plugin);
loadPlugin.withArgs('pip').returns(plugin);

await cli.monitor('gradle-app', 'pip-app', {'all-sub-projects': true});
t.true(spyPlugin.args[0][2].multiDepRoots);

let req = server.popRequest();
t.equal(req.method, 'PUT', 'makes PUT request for pip');
t.match(req.url, '/monitor/pip', 'puts at correct url');
req = server.popRequest();
t.equal(req.method, 'PUT', 'makes PUT request for gradle');
t.match(req.url, '/monitor/gradle', 'puts at correct url');

t.same(spyPlugin.getCall(0).args,
['gradle-app', 'build.gradle', {
"all-sub-projects": true,
"multiDepRoots": true,
"args": null,
}], 'calls plugin for the 1st path');
t.same(spyPlugin.getCall(1).args,
['pip-app', 'requirements.txt', {
"all-sub-projects": true,
// No multiDepRoots, because only Gradle plugin loader sets it
"args": null,
}], 'calls plugin for the 2nd path');
});

test('`monitor gradle-app --all-sub-projects --project-name`', async (t) => {
t.plan(2);
chdirWorkspaces();
Expand Down

0 comments on commit 4b7b430

Please sign in to comment.