11import Service , { inject , service } from '@ember/service' ;
22import EmberObject from '@ember/object' ;
3- import { buildOwner , runDestroy } from 'internal-test-helpers' ;
4- import { moduleFor , AbstractTestCase } from 'internal-test-helpers' ;
3+ import {
4+ AbstractTestCase ,
5+ buildOwner ,
6+ expectDeprecation ,
7+ moduleFor ,
8+ runDestroy ,
9+ testUnless ,
10+ } from 'internal-test-helpers' ;
11+ import { DEPRECATIONS } from '../../-internals/deprecations' ;
512
613moduleFor (
714 'inject - decorator (TS)' ,
815 class extends AbstractTestCase {
9- [ '@test works with native decorators' ] ( assert : QUnit [ 'assert' ] ) {
16+ [ `${ testUnless (
17+ DEPRECATIONS . DEPRECATE_IMPORT_INJECT . isRemoved
18+ ) } @test works with native decorators`] ( assert : QUnit [ 'assert' ] ) {
19+ expectDeprecation (
20+ / ' I m p o r t i n g ` i n j e c t ` f r o m ` @ e m b e r \/ s e r v i c e ` i s d e p r e c a t e d . P l e a s e i m p o r t ` s e r v i c e ` i n s t e a d .' / ,
21+ DEPRECATIONS . DEPRECATE_IMPORT_INJECT . isEnabled
22+ ) ;
23+
1024 let owner = buildOwner ( ) ;
1125
1226 class MainService extends Service { }
@@ -25,7 +39,14 @@ moduleFor(
2539 runDestroy ( owner ) ;
2640 }
2741
28- [ '@test uses the decorated property key if not provided' ] ( assert : QUnit [ 'assert' ] ) {
42+ [ `${ testUnless (
43+ DEPRECATIONS . DEPRECATE_IMPORT_INJECT . isRemoved
44+ ) } @test uses the decorated property key if not provided`] ( assert : QUnit [ 'assert' ] ) {
45+ expectDeprecation (
46+ / ' I m p o r t i n g ` i n j e c t ` f r o m ` @ e m b e r \/ s e r v i c e ` i s d e p r e c a t e d . P l e a s e i m p o r t ` s e r v i c e ` i n s t e a d .' / ,
47+ DEPRECATIONS . DEPRECATE_IMPORT_INJECT . isEnabled
48+ ) ;
49+
2950 let owner = buildOwner ( ) ;
3051
3152 class MainService extends Service { }
0 commit comments