Skip to content

Commit

Permalink
Refactor complex EC test to use the ec-wire helper
Browse files Browse the repository at this point in the history
  • Loading branch information
DingoEatingFuzz committed Dec 7, 2017
1 parent 74c615d commit d5e4117
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions ui/tests/integration/task-log-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { find, click } from 'ember-native-dom-helpers';
import hbs from 'htmlbars-inline-precompile';
import Pretender from 'pretender';
import { logEncode } from '../../mirage/data/logs';
import ecWire from '../helpers/ec-wire';

const { run } = Ember;

Expand Down Expand Up @@ -135,26 +136,24 @@ test('Clicking toggleStream starts and stops the log stream', function(assert) {
this.setProperties(commonProps);
this.render(hbs`{{task-log allocation=allocation task=task interval=interval}}`);

run.later(() => {
click('.action-toggle-stream');
}, interval);

return wait().then(() => {
assert.equal(find('.cli-window').textContent, streamFrames[0], 'First frame loaded');

run.later(() => {
return ecWire('-a.b--c--|d', interval, {
a: () => {
click('.action-toggle-stream');
},
b: () => {
assert.equal(find('.cli-window').textContent, streamFrames[0], 'First frame loaded');
},
c: () => {
assert.equal(find('.cli-window').textContent, streamFrames[0], 'Still only first frame');
click('.action-toggle-stream');
run.later(run, run.cancelTimers, interval * 2);
}, interval * 2);

return wait().then(() => {
},
d: () => {
assert.equal(
find('.cli-window').textContent,
streamFrames[0] + streamFrames[0] + streamFrames[1],
'Now includes second frame'
);
});
},
});
});

Expand Down

0 comments on commit d5e4117

Please sign in to comment.