1
1
import { render } from ' @1024pix/ember-testing-library' ;
2
- import { click } from ' @ember/test-helpers' ;
3
2
import { t } from ' ember-intl/test-support' ;
4
3
import LiveAlert from ' mon-pix/components/assessments/live-alert' ;
5
4
import { module , test } from ' qunit' ;
6
- import sinon from ' sinon' ;
7
5
8
6
import setupIntlRenderingTest from ' ../../../helpers/setup-intl-rendering' ;
9
7
@@ -12,34 +10,14 @@ module('Integration | Component | Assessments | live-alert', function (hooks) {
12
10
13
11
test (' it displays challenge live alert' , async function (assert ) {
14
12
// given
15
- const assessment = {
16
- reload: sinon .stub (),
17
- };
18
13
const message = t (' pages.challenge.live-alerts.companion.message' );
19
14
20
15
// when
21
- const screen = await render (<template ><LiveAlert @ assessment = {{ assessment }} @ message ={{message }} /></template >);
16
+ const screen = await render (<template ><LiveAlert @ message ={{message }} /></template >);
22
17
23
18
// then
24
19
assert .dom (screen .getByText (message)).exists ();
25
20
assert .dom (screen .getByText (t (' pages.challenge.live-alerts.waiting-information' ))).exists ();
26
21
assert .dom (screen .getByRole (' button' , { name: t (' pages.challenge.live-alerts.refresh' ) })).exists ();
27
22
});
28
-
29
- module (' when user clicks refresh button' , function () {
30
- test (' it should reload assessment' , async function (assert ) {
31
- // given
32
- const assessment = {
33
- reload: sinon .stub (),
34
- };
35
- const screen = await render (<template ><LiveAlert @ assessment ={{assessment }} /></template >);
36
-
37
- // when
38
- await click (screen .getByRole (' button' , { name: t (' pages.challenge.live-alerts.refresh' ) }));
39
-
40
- // then
41
- sinon .assert .calledOnce (assessment .reload );
42
- assert .ok (true );
43
- });
44
- });
45
23
});
0 commit comments