@@ -27,19 +27,28 @@ describe('avoidDeprecated', () => {
2727 expect ( errorCount ) . toEqual ( 0 ) ;
2828 } ) ;
2929
30- it ( 'generates the right warning ' , ( ) => {
30+ it ( 'matches the message pattern ' , ( ) => {
3131 const { messages } = res . results [ 0 ] ! ;
32-
3332 const text = messages [ 0 ] . message ;
33+
3434 expect ( text ) . toMatch ( stringPattern ) ;
3535 } ) ;
3636
3737 it ( 'generates exactly the right warning' , ( ) => {
3838 const { messages } = res . results [ 0 ] ! ;
39-
4039 const text = messages [ 0 ] . message ;
40+
4141 expect ( text ) . toMatch ( `Avoid using 'category' since it's deprecated. use color instead` ) ;
4242 } ) ;
43+
44+ it ( 'the warning is at the right position' , ( ) => {
45+ const { messages } = res . results [ 0 ] ! ;
46+ const { column, line, endColumn } = messages [ 0 ] ;
47+
48+ expect ( line ) . toEqual ( 7 ) ;
49+ expect ( column ) . toEqual ( 31 ) ;
50+ expect ( endColumn ) . toEqual ( 39 ) ;
51+ } ) ;
4352 } ) ;
4453
4554 describe ( 'when the component interface is in the same file' , ( ) => {
@@ -57,7 +66,7 @@ describe('avoidDeprecated', () => {
5766 expect ( errorCount ) . toEqual ( 0 ) ;
5867 } ) ;
5968
60- it ( 'generates the right warnings ' , ( ) => {
69+ it ( 'matches the message pattern ' , ( ) => {
6170 const { messages } = res . results [ 0 ] ! ;
6271
6372 const text1 = messages [ 0 ] . message ;
@@ -76,6 +85,18 @@ describe('avoidDeprecated', () => {
7685 const text2 = messages [ 1 ] . message ;
7786 expect ( text2 ) . toMatch ( `Avoid using 'someProp2' since it's deprecated. reason2` ) ;
7887 } ) ;
88+
89+ it ( 'the warnings are at the right position' , ( ) => {
90+ const { messages } = res . results [ 0 ] ! ;
91+
92+ expect ( messages [ 0 ] . line ) . toEqual ( 27 ) ;
93+ expect ( messages [ 0 ] . column ) . toEqual ( 18 ) ;
94+ expect ( messages [ 0 ] . endColumn ) . toEqual ( 26 ) ;
95+
96+ expect ( messages [ 1 ] . line ) . toEqual ( 27 ) ;
97+ expect ( messages [ 1 ] . column ) . toEqual ( 30 ) ;
98+ expect ( messages [ 1 ] . endColumn ) . toEqual ( 39 ) ;
99+ } ) ;
79100 } ) ;
80101
81102 describe ( 'when the component interface extends from another interface' , ( ) => {
@@ -93,7 +114,7 @@ describe('avoidDeprecated', () => {
93114 expect ( errorCount ) . toEqual ( 0 ) ;
94115 } ) ;
95116
96- it ( 'generates the right warning ' , ( ) => {
117+ it ( 'matches the message pattern ' , ( ) => {
97118 const { messages } = res . results [ 0 ] ! ;
98119
99120 const text = messages [ 0 ] . message ;
0 commit comments