[
https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123853#comment-16123853
]
ASF GitHub Bot commented on CB-12361:
-------------------------------------
Github user stevengill commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/581#discussion_r132758854
--- Diff: spec/cordova/plugin/remove.spec.js ---
@@ -32,18 +66,123 @@ describe('cordova/plugin/remove', function () {
expect(e.message).toContain('No plugin specified');
}).done(done);
});
- it('should require that a provided plugin be installed in the
current project');
+
+ it('should require that a provided plugin be installed in the
current project', function (done) {
+ var opts = { plugins: [ undefined ] };
+ remove(projectRoot, 'plugin', hook_mock, opts).then(function
() {
+ fail('success handler unexpectedly invoked');
+ }).fail(function (e) {
+ expect(e.message).toContain('is not present in the
project');
+ }).done(done);
+ });
});
describe('happy path', function () {
- it('should fire the before_plugin_rm hook');
- it('should call plugman.uninstall.uninstallPlatform for each
platform installed in the project and for each provided plugin');
- it('should trigger a prepare if
plugman.uninstall.uninstallPlatform returned something falsy');
- it('should call plugman.uninstall.uninstallPlugin once plugin has
been uninstalled for each platform');
+ it('should fire the before_plugin_rm hook', function (done) {
+ var opts = { important: 'options', plugins: [] };
+ remove(projectRoot, 'cordova-plugin-splashscreen', hook_mock,
opts).then(function () {
+
expect(hook_mock.fire).toHaveBeenCalledWith('before_plugin_rm', opts);
+ }).fail(function (e) {
+ fail('fail handler unexpectedly invoked');
+ console.error(e);
+ }).done(done);
+ });
+
+ it('should call plugman.uninstall.uninstallPlatform for each
platform installed in the project and for each provided plugin', function
(done) {
+
remove.validatePluginId.and.returnValue('cordova-plugin-splashscreen');
+ var opts = {important: 'options', plugins:
['cordova-plugin-splashscreen']};
+ remove(projectRoot, 'cordova-plugin-splashscreen', hook_mock,
opts).then(function () {
+
expect(plugman.uninstall.uninstallPlatform).toHaveBeenCalled();
+ expect(events.emit).toHaveBeenCalledWith('verbose',
jasmine.stringMatching('plugman.uninstall on plugin
"cordova-plugin-splashscreen" for platform "ios"'));
+ expect(events.emit).toHaveBeenCalledWith('verbose',
jasmine.stringMatching('plugman.uninstall on plugin
"cordova-plugin-splashscreen" for platform "android"'));
+ }).fail(function (e) {
+ fail('fail handler unexpectedly invoked');
+ console.error(e);
+ }).done(done);
+ });
+
+ it('should trigger a prepare if
plugman.uninstall.uninstallPlatform returned something falsy', function (done) {
+
remove.validatePluginId.and.returnValue('cordova-plugin-splashscreen');
+ plugman.uninstall.uninstallPlatform.and.returnValue(Q(false));
+ var opts = {important: 'options', plugins:
['cordova-plugin-splashscreen']};
+ remove(projectRoot, 'cordova-plugin-splashscreen', hook_mock,
opts).then(function () {
+
expect(plugman.uninstall.uninstallPlatform).toHaveBeenCalled();
+ expect(events.emit).toHaveBeenCalledWith('verbose',
'Calling prepare.');
--- End diff --
i'd suggest removing this expect event due to my other comment
> Speed up cordova-lib tests
> --------------------------
>
> Key: CB-12361
> URL: https://issues.apache.org/jira/browse/CB-12361
> Project: Apache Cordova
> Issue Type: Improvement
> Components: cordova-lib
> Reporter: Steve Gill
> Assignee: Steve Gill
> Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]