Skip to content

Commit c67903c

Browse files
committed
Split tests per function
1 parent 92ff135 commit c67903c

5 files changed

+525
-437
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { deprecate } from '@ember/debug';
2+
import { module } from 'qunit';
3+
import test from '../helpers/debug-test';
4+
5+
let originalWarn;
6+
7+
module('flushDeprecations', function (hooks) {
8+
hooks.beforeEach(function () {
9+
originalWarn = window.Testem.handleConsoleMessage;
10+
});
11+
12+
hooks.afterEach(function () {
13+
window.deprecationWorkflow.deprecationLog = { messages: {} };
14+
window.Testem.handleConsoleMessage = originalWarn;
15+
});
16+
17+
test('works', function (assert) {
18+
deprecate('silence-strict', false, {
19+
since: '2.0.0',
20+
until: 'forever',
21+
id: 'test',
22+
for: 'testing',
23+
});
24+
25+
deprecate('log-strict', false, {
26+
since: '2.0.0',
27+
until: 'forever',
28+
id: 'test',
29+
for: 'testing',
30+
});
31+
32+
deprecate(' foo log-match foo', false, {
33+
since: 'now',
34+
until: 'forever',
35+
id: 'test',
36+
for: 'testing',
37+
});
38+
39+
deprecate(' foo foo', false, {
40+
since: 'now',
41+
until: 'forever',
42+
id: 'log-strict',
43+
for: 'testing',
44+
});
45+
46+
deprecate('arbitrary-unmatched-message', false, {
47+
id: 'log-strict',
48+
since: '2.0.0',
49+
until: '3.0.0',
50+
for: 'testing',
51+
});
52+
53+
const deprecationsPayload = self.deprecationWorkflow.flushDeprecations();
54+
55+
assert.strictEqual(
56+
deprecationsPayload,
57+
`import setupDeprecationWorkflow from 'ember-cli-deprecation-workflow';
58+
59+
setupDeprecationWorkflow({
60+
workflow: [
61+
{ handler: "silence", matchId: "test" },
62+
{ handler: "silence", matchId: "log-strict" }
63+
]
64+
});`
65+
);
66+
});
67+
});

tests/index.html

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
{{content-for "body"}}
2222
{{content-for "test-body"}}
2323

24+
<div id="qunit"></div>
25+
<div id="qunit-fixture">
26+
<div id="ember-testing-container">
27+
<div id="ember-testing"></div>
28+
</div>
29+
</div>
30+
2431
<script src="/testem.js" integrity="" data-embroider-ignore></script>
2532
<script src="{{rootURL}}assets/vendor.js"></script>
2633
<script src="{{rootURL}}assets/test-support.js"></script>

0 commit comments

Comments
 (0)