Skip to content

Commit eb6739f

Browse files
committed
fix: conditional tests
1 parent 30da677 commit eb6739f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

test-app/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"@ember/optional-features": "^2.0.0",
3838
"@ember/string": "^3.1.1",
3939
"@ember/test-helpers": "^2.9.3",
40+
"@embroider/macros": "^1.13.2",
4041
"@embroider/test-setup": "^2.0.2",
4142
"@glimmer/component": "^1.1.2",
4243
"@glimmer/tracking": "^1.1.2",

test-app/tests/acceptance/routeable-engine-demo-refresh-test.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
import { module, test } from 'qunit';
22
import { setupApplicationTest } from 'ember-qunit';
33
import { visit, find, click } from '@ember/test-helpers';
4+
import { macroCondition, dependencySatisfies } from '@embroider/macros';
45

56
module('Acceptance | Engine Router Service | Refresh Method', function (hooks) {
67
setupApplicationTest(hooks);
78

89
test('refresh without params triggers refresh with current route', async function (assert) {
10+
assert.expect(1);
911
await visit('/routable-engine-demo/ember-blog/new');
1012

1113
let counter = await find('.route-refresh-counter').textContent;
12-
await click('.refresh');
13-
14-
counter = parseInt(counter, 10);
15-
counter = ++counter;
16-
counter = counter.toString();
17-
assert.dom('.route-refresh-counter').hasText(counter);
14+
if (macroCondition(dependencySatisfies('ember-source', '>= 4.1.0'))) {
15+
await click('.refresh');
16+
17+
counter = parseInt(counter, 10);
18+
counter = ++counter;
19+
counter = counter.toString();
20+
assert.dom('.route-refresh-counter').hasText(counter);
21+
} else {
22+
// eslint-disable-next-line qunit/no-conditional-assertions
23+
assert.throws(async () => {
24+
await click('.refresh');
25+
});
26+
}
1827
});
1928

2029
test('refresh with params triggers refresh on provided route', async function (assert) {

0 commit comments

Comments
 (0)