This repository was archived by the owner on Feb 4, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ const test = require ( 'ava' ) ;
2
+ const sinon = require ( 'sinon' ) ;
3
+ const proxyquire = require ( 'proxyquire' ) ;
4
+
5
+ const BemEntityName = require ( '../lib/entity-name' ) ;
6
+
7
+ const deprecateSpy = sinon . spy ( ) ;
8
+ const deprecate = proxyquire ( '../lib/deprecate' , {
9
+ 'depd' :( ) => deprecateSpy
10
+ } ) ;
11
+
12
+ test ( 'should deprecate object' , t => {
13
+ deprecate ( { block : 'block' } , 'oldField' , 'newField' ) ;
14
+
15
+ const message = [
16
+ "`oldField` is kept just for compatibility and can be dropped in the future." ,
17
+ "Use `newField` instead in `{ block: 'block' }` at"
18
+ ] . join ( ' ' ) ;
19
+
20
+ t . true ( deprecateSpy . calledWith ( message ) ) ;
21
+ } ) ;
22
+
23
+ test ( 'should deprecate BemEntityName instance' , t => {
24
+ deprecate ( new BemEntityName ( { block : 'block' } ) , 'oldField' , 'newField' ) ;
25
+
26
+ const message = [
27
+ "`oldField` is kept just for compatibility and can be dropped in the future." ,
28
+ "Use `newField` instead in `BemEntityName { block: 'block' }` at"
29
+ ] . join ( ' ' ) ;
30
+
31
+ t . true ( deprecateSpy . calledWith ( message ) ) ;
32
+ } ) ;
You can’t perform that action at this time.
0 commit comments