Chromium Code Reviews| Index: remoting/webapp/crd/js/apps_v2_migration_unittest.js |
| diff --git a/remoting/webapp/crd/js/apps_v2_migration_unittest.js b/remoting/webapp/crd/js/apps_v2_migration_unittest.js |
| index 097a80f598d3604e85f1dbcf63c0d3de49362953..0b83829e0baadf5abac61ee9ce2682b2ce02c075 100644 |
| --- a/remoting/webapp/crd/js/apps_v2_migration_unittest.js |
| +++ b/remoting/webapp/crd/js/apps_v2_migration_unittest.js |
| @@ -15,16 +15,6 @@ |
| var mockIsAppsV2 = null; |
| var mockChromeStorage = {}; |
| -function pass() { |
| - ok(true); |
| - QUnit.start(); |
| -} |
| - |
| -function fail() { |
| - ok(false); |
| - QUnit.start(); |
| -} |
| - |
| /** |
| * @param {string} v1UserName |
| * @param {string} v1UserEmail |
| @@ -56,64 +46,65 @@ function setMigrationData_(v1UserName, v1UserEmail, v1HasHosts) { |
| } |
| } |
| -module('AppsV2Migration', { |
| - setup: function() { |
| +QUnit.module('AppsV2Migration', { |
| + beforeEach: function() { |
| chromeMocks.activate(['storage']); |
| mockIsAppsV2 = sinon.stub(base, 'isAppsV2'); |
| remoting.identity = new remoting.Identity(); |
| }, |
| - teardown: function() { |
| + afterEach: function() { |
| chromeMocks.restore(); |
| mockIsAppsV2.restore(); |
| remoting.identity = null; |
| } |
| }); |
| -QUnit.asyncTest( |
| +QUnit.test( |
| 'hasHostsInV1App() should reject the promise if v1 user has same identity', |
| function() { |
| + QUnit.expect(0); |
| setMigrationData_('v1userName', 'v2user@gmail.com', true); |
| mockIsAppsV2.returns(true); |
| - remoting.AppsV2Migration.hasHostsInV1App().then(fail, pass); |
| + return base.Promise.negate(remoting.AppsV2Migration.hasHostsInV1App()); |
| }); |
| -QUnit.asyncTest( |
| +QUnit.test( |
| 'hasHostsInV1App() should reject the promise if v1 user has no hosts', |
| function() { |
| + QUnit.expect(0); |
| setMigrationData_('v1userName', 'v1user@gmail.com', false); |
| mockIsAppsV2.returns(true); |
| - remoting.AppsV2Migration.hasHostsInV1App().then(fail, pass); |
| + return base.Promise.negate(remoting.AppsV2Migration.hasHostsInV1App()); |
| }); |
| -QUnit.asyncTest( |
| +QUnit.test( |
| 'hasHostsInV1App() should reject the promise in v1', function() { |
| + QUnit.expect(0); |
| setMigrationData_('v1userName', 'v1user@gmail.com', true); |
| mockIsAppsV2.returns(false); |
| - remoting.AppsV2Migration.hasHostsInV1App().then(fail, pass); |
| + return base.Promise.negate(remoting.AppsV2Migration.hasHostsInV1App()); |
| }); |
| -QUnit.asyncTest( |
| +QUnit.test( |
| 'hasHostsInV1App() should return v1 identity if v1 user has hosts', |
| function() { |
| setMigrationData_('v1userName', 'v1user@gmail.com', true); |
| mockIsAppsV2.returns(true); |
| - remoting.AppsV2Migration.hasHostsInV1App().then( |
| - /** @param {{email:string, name:string}} result */ |
| - function(result) { |
| + return remoting.AppsV2Migration.hasHostsInV1App().then( |
| + function(/** {email:string, name:string} */ result) { |
| QUnit.equal(result.email, 'v1user@gmail.com'); |
| QUnit.equal(result.fullName, 'v1userName'); |
|
John Williams
2015/03/17 19:22:37
Not part of your change, but there's a mismatch he
|
| - pass(); |
| - }, fail |
| - ); |
| + }); |
| }); |
| -QUnit.asyncTest( |
| +QUnit.test( |
| 'saveUserInfo() should clear the preferences on v2', |
| function() { |
| + QUnit.expect(0); |
| setMigrationData_('v1userName', 'v1user@gmail.com', true); |
| mockIsAppsV2.returns(true); |
| remoting.AppsV2Migration.saveUserInfo(); |
| - remoting.AppsV2Migration.hasHostsInV1App().then(fail, pass); |
| + return base.Promise.negate(remoting.AppsV2Migration.hasHostsInV1App()); |
| }); |
| })(); |