|
1 | 1 | import { test, module } from 'qunit'; |
2 | 2 | import { assert } from '@ember/debug'; |
| 3 | +import { DEBUG } from '@glimmer/env'; |
| 4 | +import { isDevelopingApp, isTesting } from '@embroider/macros'; |
3 | 5 |
|
4 | 6 | module('debug utils remain in the build', function () { |
5 | | - test('debug utils work in tests', function(qAssert) { |
| 7 | + test('assert', function(qAssert) { |
| 8 | + // If we get the build mode wrong, e.g.: `NODE_ENV` != 'development' |
| 9 | + // then the assert won't exist, causing qAssert to not detect a thrown Error |
6 | 10 | qAssert.throws(() => { |
7 | | - // If we get the build mode wrong, e.g.: `NODE_ENV` != 'development' |
8 | | - // then the assert will be stripped and qAssert will not detect an error being thrown |
9 | | - assert('it works', false); |
10 | | - }, 'it works'); |
| 11 | + assert('should throw'); |
| 12 | + }, /should throw/, `The error "should throw" is thrown`); |
| 13 | + |
| 14 | + }); |
| 15 | + |
| 16 | + test('DEBUG', function (assert) { |
| 17 | + if (DEBUG) { |
| 18 | + assert.step('DEBUG'); |
| 19 | + } |
| 20 | + |
| 21 | + assert.verifySteps(['DEBUG']); |
| 22 | + }); |
| 23 | + |
| 24 | + test('isTesting', function (assert) { |
| 25 | + assert.strictEqual(isTesting(), true, `isTesting() === true`); |
| 26 | + }); |
| 27 | + |
| 28 | + test('isDevelopingApp', function (assert) { |
| 29 | + assert.strictEqual(isDevelopingApp(), true, `isDevelopingApp() === true`); |
11 | 30 | }); |
12 | 31 | }); |
0 commit comments