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

View File

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