Fixed ios install and uninstall test
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/f4008047 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/f4008047 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/f4008047 Branch: refs/heads/master Commit: f4008047c9c09bf492f9212170cd3d6c8acaf654 Parents: e3042ba Author: Tim Kim <[email protected]> Authored: Wed Apr 17 16:38:36 2013 -0700 Committer: Tim Kim <[email protected]> Committed: Wed Apr 17 16:59:59 2013 -0700 ---------------------------------------------------------------------- test/plugman.js | 39 +++++++++++++++++++++++++++------------ 1 files changed, 27 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/f4008047/test/plugman.js ---------------------------------------------------------------------- diff --git a/test/plugman.js b/test/plugman.js index 19bfc1f..fc9d3f8 100644 --- a/test/plugman.js +++ b/test/plugman.js @@ -49,39 +49,54 @@ exports['should list all plugins'] = function (test) { } exports['should install and uninstall ios plugin'] = function (test) { - var test_project_dir = path.join(test_dir, 'ios-config-xml'), - test_plugin_dir = path.join(test_dir, 'WebNotifications'), + var test_project_dir = path.join(test_dir, 'projects', 'ios-config-xml'), + test_plugins_dir = path.join(test_dir, 'plugins'), srcDir = path.resolve(test_project_dir, 'SampleApp/Plugins'), + srcPluginDir = path.join(__dirname, 'plugins', 'WebNotifications'), options = {silent: true}, command; // copy the ios test project to a temp directory - shell.cp('-r', path.join(__dirname, 'projects', 'ios-config-xml'), test_dir); + shell.cp('-r', path.join(__dirname, 'projects'), test_dir); - // copy the ios test plugin to a temp directory - shell.cp('-r', path.join(__dirname, 'plugins', 'WebNotifications'), test_dir); + // create the plugins dir to the temp directory + shell.mkdir('-p', test_plugins_dir); + + command = util.format('%s %s --fetch --plugin %s --plugins_dir %s', shell.which('node'), + plugman_exe, + srcPluginDir, + test_plugins_dir + ); - command = util.format('%s %s --platform ios --project %s --plugin %s', shell.which('node'), + var ret = shell.exec(command, options); + test.equal(0, ret.code); + + command = util.format('%s %s --platform ios --project %s --plugin %s --plugins_dir %s', shell.which('node'), plugman_exe, test_project_dir, - test_plugin_dir + 'WebNotifications', + test_plugins_dir ); - var ret = shell.exec(command, options); + + ret = shell.exec(command, options); test.equal(0, ret.code); test.equal("plugin installed\n", ret.output); - + + test.ok(fs.existsSync(srcDir + '/WebNotifications.m')) test.ok(fs.existsSync(srcDir + '/WebNotifications.h')); - command = util.format('%s %s --remove --platform ios --project %s --plugin %s', shell.which('node'), + command = util.format('%s %s --uninstall --platform ios --project %s --plugin %s --plugins_dir %s', shell.which('node'), plugman_exe, test_project_dir, - test_plugin_dir + 'WebNotifications', + test_plugins_dir ); + var ret = shell.exec(command, options); test.equal(0, ret.code); test.equal("plugin uninstalled\n", ret.output); - + test.ok(!fs.existsSync(srcDir + '/WebNotifications.m')) test.ok(!fs.existsSync(srcDir + '/WebNotifications.h'));
