Skip to content

Commit 6fe9fb7

Browse files
committed
chore(internal): add tests for enable/disable inertness
1 parent ec6cf33 commit 6fe9fb7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/unit/inert-test.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { module, test } from 'qunit';
2+
import { setupTest } from 'ember-qunit';
3+
4+
import { macroCondition, dependencySatisfies } from '@embroider/macros';
5+
6+
module('Unit | inert', function (hooks) {
7+
setupTest(hooks);
8+
9+
function hasPolyfill() {
10+
let initializers = ['install-function-helper-manager', 'usable-function-manager'];
11+
12+
return Object.keys(window.requirejs.entries).some(e => initializers.some(name => e.includes(name)))
13+
}
14+
15+
if (macroCondition(dependencySatisfies('ember-source', '4.5.0-alpha.3'))) {
16+
17+
test('polyfill is inert', function(assert) {
18+
assert.strictEqual(hasPolyfill(), false, 'no polyfill');
19+
});
20+
21+
} else {
22+
23+
test('polyfill is present', function(assert) {
24+
assert.strictEqual(hasPolyfill(), true, 'has polyfill');
25+
});
26+
27+
}
28+
29+
});

0 commit comments

Comments
 (0)