Fix flaky test in plugin list
Change-Id: I2c37ac77639d13f525d14de1d1ae97c5fb13ff15
This commit is contained in:
@@ -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';
|
||||||
},
|
},
|
||||||
|
@@ -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);
|
assert.equal(element._plugins[2].id, 'test3');
|
||||||
|
assert.equal(element._plugins[2].index_url, 'plugins/test3/');
|
||||||
stub('gr-rest-api-interface', {
|
assert.equal(element._plugins[2].version, '3.0-SNAPSHOT');
|
||||||
getPlugins() {
|
assert.equal(element._plugins[2].disabled, false);
|
||||||
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();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user