-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d7abba
commit c0e2bc8
Showing
5 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { getDeprecations } from '@ember/test-helpers'; | ||
import toAssertionMessage from './utils/to-assertion-message'; | ||
|
||
export default function deprecationsInclude (expected) { | ||
const deprecations = getDeprecations().map(toAssertionMessage); | ||
this.pushResult({ | ||
result: deprecations.indexOf(expected) > -1, | ||
actual: deprecations, | ||
message: `expected to find \`${expected}\` deprecation`, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { getDeprecationsDuringCallback } from '@ember/test-helpers'; | ||
import toAssertionMessage from './utils/to-assertion-message'; | ||
|
||
export default async function deprecations(callback, expectedDeprecations) { | ||
const maybeThenable = getDeprecationsDuringCallback(callback); | ||
|
||
const operation = (deprecations) => { | ||
this.deepEqual( | ||
deprecations.map(toAssertionMessage), | ||
expectedDeprecations, | ||
'Expected deprecations during test.' | ||
); | ||
} | ||
|
||
if (typeof maybeThenable === 'object' && maybeThenable !== null && typeof maybeThenable.then === 'function') { | ||
operation(await maybeThenable); | ||
} else { | ||
operation(maybeThenable); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { getDeprecations } from '@ember/test-helpers'; | ||
import toAssertionMessage from './utils/to-assertion-message'; | ||
|
||
export default function noDeprecations() { | ||
this.deepEqual( | ||
getDeprecations().map(toAssertionMessage), | ||
[], | ||
'Expected no deprecations during test.' | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function toAssertionMessage(assertion) { | ||
return assertion.message; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters