Skip to content

Commit

Permalink
Split tests per function
Browse files Browse the repository at this point in the history
  • Loading branch information
lolmaus committed Oct 26, 2023
1 parent 92ff135 commit c67903c
Show file tree
Hide file tree
Showing 5 changed files with 525 additions and 437 deletions.
67 changes: 67 additions & 0 deletions tests/acceptance/flush-deprecations-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { deprecate } from '@ember/debug';
import { module } from 'qunit';
import test from '../helpers/debug-test';

let originalWarn;

module('flushDeprecations', function (hooks) {
hooks.beforeEach(function () {
originalWarn = window.Testem.handleConsoleMessage;
});

hooks.afterEach(function () {
window.deprecationWorkflow.deprecationLog = { messages: {} };
window.Testem.handleConsoleMessage = originalWarn;
});

test('works', function (assert) {
deprecate('silence-strict', false, {
since: '2.0.0',
until: 'forever',
id: 'test',
for: 'testing',
});

deprecate('log-strict', false, {
since: '2.0.0',
until: 'forever',
id: 'test',
for: 'testing',
});

deprecate(' foo log-match foo', false, {
since: 'now',
until: 'forever',
id: 'test',
for: 'testing',
});

deprecate(' foo foo', false, {
since: 'now',
until: 'forever',
id: 'log-strict',
for: 'testing',
});

deprecate('arbitrary-unmatched-message', false, {
id: 'log-strict',
since: '2.0.0',
until: '3.0.0',
for: 'testing',
});

const deprecationsPayload = self.deprecationWorkflow.flushDeprecations();

assert.strictEqual(
deprecationsPayload,
`import setupDeprecationWorkflow from 'ember-cli-deprecation-workflow';
setupDeprecationWorkflow({
workflow: [
{ handler: "silence", matchId: "test" },
{ handler: "silence", matchId: "log-strict" }
]
});`
);
});
});
7 changes: 7 additions & 0 deletions tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
{{content-for "body"}}
{{content-for "test-body"}}

<div id="qunit"></div>
<div id="qunit-fixture">
<div id="ember-testing-container">
<div id="ember-testing"></div>
</div>
</div>

<script src="/testem.js" integrity="" data-embroider-ignore></script>
<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/test-support.js"></script>
Expand Down

0 comments on commit c67903c

Please sign in to comment.