Fix flaky test in plugin list

Change-Id: I2c37ac77639d13f525d14de1d1ae97c5fb13ff15
This commit is contained in:
Becky Siegel
2017-06-14 13:19:32 -07:00
parent 0ba010cc51
commit 1f25750cf7
2 changed files with 14 additions and 24 deletions

View File

@@ -30,6 +30,10 @@
],
ready() {
this._getPlugins();
},
_getPlugins() {
return this.$.restAPI.getPlugins()
.then(plugins => {
if (!plugins) {
@@ -46,7 +50,6 @@
});
},
_status(item) {
return item.disabled === true ? 'Disabled' : 'Enabled';
},

View File

@@ -50,6 +50,10 @@ limitations under the License.
setup(() => {
sandbox = sinon.sandbox.create();
plugins = _.times(26, pluginGenerator);
stub('gr-rest-api-interface', {
getPlugins() { return Promise.resolve(plugins); },
});
element = fixture('basic');
});
@@ -57,29 +61,12 @@ limitations under the License.
sandbox.restore();
});
suite('list with plugins', () => {
setup(done => {
plugins = _.times(26, pluginGenerator);
stub('gr-rest-api-interface', {
getPlugins() {
return Promise.resolve(plugins);
},
});
flush(done);
});
test('test for a test plugin in the list', done => {
element._plugins = plugins;
flush(() => {
assert.equal(element._plugins[2].id, 'test3');
assert.equal(element._plugins[2].index_url, 'plugins/test3/');
assert.equal(element._plugins[2].version, '3.0-SNAPSHOT');
assert.equal(element._plugins[2].disabled, false);
done();
});
test('_plugins item is formatted correctly', () => {
return element._getPlugins().then(() => {
assert.equal(element._plugins[2].id, 'test3');
assert.equal(element._plugins[2].index_url, 'plugins/test3/');
assert.equal(element._plugins[2].version, '3.0-SNAPSHOT');
assert.equal(element._plugins[2].disabled, false);
});
});
});