This repository was archived by the owner on Sep 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ function getSourceLocationOffset(quasi: ts.TaggedTemplateExpression) {
170170 const pos = getTemplateNode ( quasi ) . pos ;
171171 const loc = quasi . getSourceFile ( ) . getLineAndCharacterOfPosition ( pos ) ;
172172 return {
173- line : loc . line + 1 ,
173+ line : loc . line ,
174174 column : loc . character + 1
175175 } ;
176176}
Original file line number Diff line number Diff line change 1+ import * as FindGraphQLTags from '../src/FindGraphQLTags'
2+
3+ describe ( 'FindGraphQLTags' , ( ) => {
4+ function find ( text ) {
5+ return FindGraphQLTags . find ( text , '/path/to/TestModule.ts' )
6+ }
7+
8+ it ( 'extracts a tag' , ( ) => {
9+ expect ( find ( `
10+ import { createFragmentContainer, graphql } from 'react-relay'
11+ export default createFragmentContainer(
12+ props => <div>{props.artist.name}</div>,
13+ graphql\`
14+ fragment TestModule_artist on Artist {
15+ name
16+ }
17+ \`
18+ )
19+ ` ) ) . toEqual ( [ {
20+ keyName : null ,
21+ template : `
22+ fragment TestModule_artist on Artist {
23+ name
24+ }
25+ ` ,
26+ sourceLocationOffset : { line : 4 , column : 16 } ,
27+ } ] )
28+ } )
29+
30+ // TODO: Cover all cases where tags are extracted
31+ } )
You can’t perform that action at this time.
0 commit comments