Skip to content

Commit

Permalink
Refactor to account for conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
patocallaghan committed Feb 24, 2021
1 parent 67e3364 commit 33979b8
Showing 1 changed file with 37 additions and 5 deletions.
42 changes: 37 additions & 5 deletions packages/internal-test-helpers/lib/ember-dev/deprecation.ts
Expand Up @@ -25,17 +25,49 @@ export function setupDeprecationHelpers(hooks: NestedHooks, env: DebugEnv): void
});
}

export let expectDeprecation: DeprecationAssert['expectDeprecation'] = () => {
throw new Error(
'DeprecationAssert: To use `expectDeprecation` in a test you must call `setupDeprecationHelpers` first'
);
};

export let ignoreDeprecation: DeprecationAssert['ignoreDeprecation'] = () => {
throw new Error(
'DeprecationAssert: To use `ignoreDeprecation` in a test you must call `setupDeprecationHelpers` first'
);
};

export let expectDeprecationAsync: DeprecationAssert['expectDeprecationAsync'] = () => {
throw new Error(
'DeprecationAssert: To use `expectDeprecationAsync` in a test you must call `setupDeprecationHelpers` first'
);
};

export let expectNoDeprecation: DeprecationAssert['expectNoDeprecation'] = () => {
throw new Error(
'DeprecationAssert: To use `expectNoDeprecation` in a test you must call `setupDeprecationHelpers` first'
);
};

export let expectNoDeprecationAsync: DeprecationAssert['expectNoDeprecationAsync'] = () => {
throw new Error(
'DeprecationAssert: To use `expectNoDeprecationAsync` in a test you must call `setupDeprecationHelpers` first'
);
};

class DeprecationAssert extends DebugAssert {
constructor(env: DebugEnv) {
super('deprecate', env);
}

inject(): void {
window.expectNoDeprecation = this.expectNoDeprecation.bind(this);
window.expectNoDeprecationAsync = this.expectNoDeprecationAsync.bind(this);
window.expectDeprecation = this.expectDeprecation.bind(this);
window.expectDeprecationAsync = this.expectDeprecationAsync.bind(this);
window.ignoreDeprecation = this.ignoreDeprecation.bind(this);
window.expectNoDeprecation = expectNoDeprecation = this.expectNoDeprecation.bind(this);
window.expectNoDeprecationAsync = expectNoDeprecationAsync = this.expectNoDeprecationAsync.bind(
this
);
window.expectDeprecation = expectDeprecation = this.expectDeprecation.bind(this);
window.expectDeprecationAsync = expectDeprecationAsync = this.expectDeprecationAsync.bind(this);
window.ignoreDeprecation = ignoreDeprecation = this.ignoreDeprecation.bind(this);
super.inject();
}

Expand Down

0 comments on commit 33979b8

Please sign in to comment.