Github user stevengill commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/510#discussion_r95501615
--- Diff: cordova-lib/spec-plugman/install.spec.js ---
@@ -206,134 +178,136 @@ describe('install', function() {
beforeEach(function() {
- exec = spyOn(child_process, 'exec').andCallFake(function(cmd, cb) {
+ exec = spyOn(child_process, 'exec').and.callFake(function(cmd, cb)
{
cb(false, '', '');
});
- spawnSpy = spyOn(superspawn, 'spawn').andReturn(Q('3.1.0'));
- spyOn(fs, 'mkdirSync').andReturn(true);
- spyOn(shell, 'mkdir').andReturn(true);
- spyOn(platforms, 'copyFile').andReturn(true);
-
- fetchSpy = spyOn(plugman.raw, 'fetch').andReturn( Q(
plugins['com.cordova.engine'] ) );
- chmod = spyOn(fs, 'chmodSync').andReturn(true);
- spyOn(fs, 'writeFileSync').andReturn(true);
- cp = spyOn(shell, 'cp').andReturn(true);
- rm = spyOn(shell, 'rm').andReturn(true);
+ spawnSpy = spyOn(superspawn, 'spawn').and.returnValue(Q('3.1.0'));
+ spyOn(fs, 'mkdirSync').and.returnValue(true);
+ spyOn(shell, 'mkdir').and.returnValue(true);
+ spyOn(platforms, 'copyFile').and.returnValue(true);
+
+ fetchSpy = spyOn(plugman.raw, 'fetch').and.returnValue( Q(
plugins['com.cordova.engine'] ) );
+ chmod = spyOn(fs, 'chmodSync').and.returnValue(true);
+ spyOn(fs, 'writeFileSync').and.returnValue(true);
+ cp = spyOn(shell, 'cp').and.returnValue(true);
+ rm = spyOn(shell, 'rm').and.returnValue(true);
add_to_queue = spyOn(PlatformJson.prototype,
'addInstalledPluginToPrepareQueue');
done = false;
});
describe('success', function() {
- it('should emit a results event with platform-agnostic <info>',
function() {
+ it('Test 002 : should emit a results event with platform-agnostic
<info>', function() {
// org.test.plugins.childbrowser
expect(results['emit_results'][0]).toBe('No matter what
platform you are installing to, this notice is very important.');
});
- it('should emit a results event with platform-specific <info>',
function() {
+ it('Test 003 : should emit a results event with platform-specific
<info>', function() {
// org.test.plugins.childbrowser
expect(results['emit_results'][1]).toBe('Please make sure you
read this because it is very important to complete the installation of your
plugin.');
});
- it('should interpolate variables into <info> tags', function() {
+ it('Test 004 : should interpolate variables into <info> tags',
function() {
// VariableBrowser
expect(results['emit_results'][2]).toBe('Remember that your
api key is batman!');
});
- it('should call fetch if provided plugin cannot be resolved
locally', function() {
- fetchSpy.andReturn( Q( plugins['org.test.plugins.dummyplugin']
) );
- spyOn(fs, 'existsSync').andCallFake(
fake['existsSync']['noPlugins'] );
-
- runs(function() {
- installPromise(install('android', project,
'CLEANYOURSHORTS' ));
- });
- waitsFor(function() { return done; }, 'install promise never
resolved', 200);
- runs(function() {
- expect(done).toBe(true);
+ it('Test 005 : should call fetch if provided plugin cannot be
resolved locally', function(done) {
+ fetchSpy.and.returnValue( Q(
plugins['org.test.plugins.dummyplugin'] ) );
+ spyOn(fs, 'existsSync').and.callFake(
fake['existsSync']['noPlugins'] );
+ install('android', project, 'CLEANYOURSHORTS')
+ .fail(function(err){
+ console.log(err);
+ })
+ .fin(function () {
expect(fetchSpy).toHaveBeenCalled();
+ done();
});
});
- it('should call fetch and convert oldID to newID', function() {
- fetchSpy.andReturn( Q( plugins['org.test.plugins.dummyplugin']
) );
- spyOn(fs, 'existsSync').andCallFake(
fake['existsSync']['noPlugins'] );
+
+ it('Test 006 : should call fetch and convert oldID to newID',
function(done) {
+ fetchSpy.and.returnValue( Q(
plugins['org.test.plugins.dummyplugin'] ) );
+ spyOn(fs, 'existsSync').and.callFake(
fake['existsSync']['noPlugins'] );
var emit = spyOn(events, 'emit');
- runs(function() {
- installPromise(install('android', project,
'org.apache.cordova.device' ));
- });
- waitsFor(function() { return done; }, 'install promise never
resolved', 200);
- runs(function() {
- expect(emit.calls[0].args[1]).toBe('Notice:
org.apache.cordova.device has been automatically converted to
cordova-plugin-device and fetched from npm. This is due to our old plugins
registry shutting down.');
- expect(done).toBe(true);
+ install('android', project, 'org.apache.cordova.device' )
+ .then(function(res) {
+ return true;
+ })
+ .fail(function(err){
+ console.log(err);
--- End diff --
same as 216
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]