@@ -3,86 +3,91 @@ const expect = require('chai').expect;
3
3
const insert = require ( '../lib/actions/insert' ) ;
4
4
5
5
describe ( 'Metadata test' , ( ) => {
6
- const cfg = {
7
- query : 'INSERT INTO Test2.dbo.Tweets (Lang, Retweeted, Favorited, "Text", id, CreatedAt, Username, ScreenName) '
8
- + 'VALUES (@lang:string, @retweeted:boolean, @favorited:boolean, @text:string, @id:bigint, @created_at:date, @username:string, @screenname:string)'
9
- } ;
6
+ const cfg = {
7
+ query : 'INSERT INTO Test2.dbo.Tweets (Lang, Retweeted, Favorited, "Text", id, CreatedAt, Username, ScreenName) '
8
+ + 'VALUES (@lang:string, @retweeted:boolean, @favorited:boolean, '
9
+ + '@text:string, @id:bigint, @created_at:date, @username:string, @screenname:string)'
10
+ } ;
10
11
11
12
12
- it ( 'should generate metadata' , ( done ) => {
13
- insert . getMetaModel ( cfg , ( err , result ) => {
14
- expect ( err ) . to . be . null ;
15
- expect ( result ) . to . deep . equal ( {
16
- "in" : {
17
- " properties" : {
18
- " created_at" : {
19
- " type" : " string"
20
- } ,
21
- " favorited" : {
22
- " type" : " string"
23
- } ,
24
- "id" : {
25
- " type" : " number"
26
- } ,
27
- " lang" : {
28
- " type" : " string"
29
- } ,
30
- " retweeted" : {
31
- " type" : " string"
32
- } ,
33
- " screenname" : {
34
- " type" : " string"
35
- } ,
36
- " text" : {
37
- " type" : " string"
38
- } ,
39
- " username" : {
40
- " type" : " string"
41
- }
42
- } ,
43
- " type" : " object"
44
- } ,
45
- " out" : { }
46
- }
13
+ it ( 'should generate metadata' , ( done ) => {
14
+ insert . getMetaModel ( cfg , ( err , result ) => {
15
+ expect ( err ) . to . be . null ;
16
+ expect ( result ) . to . deep . equal ( {
17
+ in : {
18
+ properties : {
19
+ created_at : {
20
+ type : ' string'
21
+ } ,
22
+ favorited : {
23
+ type : ' string'
24
+ } ,
25
+ id : {
26
+ type : ' number'
27
+ } ,
28
+ lang : {
29
+ type : ' string'
30
+ } ,
31
+ retweeted : {
32
+ type : ' string'
33
+ } ,
34
+ screenname : {
35
+ type : ' string'
36
+ } ,
37
+ text : {
38
+ type : ' string'
39
+ } ,
40
+ username : {
41
+ type : ' string'
42
+ }
43
+ } ,
44
+ type : ' object'
45
+ } ,
46
+ out : { }
47
+ }
47
48
) ;
48
- done ( ) ;
49
+ done ( ) ;
50
+ } ) ;
49
51
} ) ;
50
- } ) ;
51
52
52
- it ( 'should not fail on empty query' , ( done ) => {
53
- insert . getMetaModel ( { } , ( err , result ) => {
54
- expect ( err ) . to . be . null ;
55
- expect ( result ) . to . deep . equal ( {
56
- "in" : {
57
- " properties" : { } ,
58
- " type" : " object"
59
- } ,
60
- " out" : { }
61
- }
53
+ it ( 'should not fail on empty query' , ( done ) => {
54
+ insert . getMetaModel ( { } , ( err , result ) => {
55
+ expect ( err ) . to . be . null ;
56
+ expect ( result ) . to . deep . equal ( {
57
+ in : {
58
+ properties : { } ,
59
+ type : ' object'
60
+ } ,
61
+ out : { }
62
+ }
62
63
) ;
63
- done ( ) ;
64
+ done ( ) ;
65
+ } ) ;
64
66
} ) ;
65
- } ) ;
66
67
67
- it ( 'should not handle duplicate fields' , ( done ) => {
68
- insert . getMetaModel ( {
69
- query : '@foo:string @foo:string @bar:date'
70
- } , ( err , result ) => {
71
- expect ( err ) . to . be . null ;
72
- expect ( result ) . to . deep . equal ( {
73
- "in" : {
74
- "type" : "object" ,
75
- "properties" : {
76
- "foo" : { type : 'string' } ,
77
- "bar" : { type : 'string' }
68
+ it ( 'should not handle duplicate fields' , ( done ) => {
69
+ insert . getMetaModel ( {
70
+ query : '@foo:string @foo:string @bar:date'
71
+ } , ( err , result ) => {
72
+ expect ( err ) . to . be . null ;
73
+ expect ( result ) . to . deep . equal ( {
74
+ in : {
75
+ type : 'object' ,
76
+ properties : {
77
+ foo : {
78
+ type : 'string'
79
+ } ,
80
+ bar : {
81
+ type : 'string'
82
+ }
83
+ }
84
+ } ,
85
+ out : { }
78
86
}
79
- } ,
80
- "out" : { }
81
- }
82
87
) ;
83
- done ( ) ;
88
+ done ( ) ;
89
+ } ) ;
84
90
} ) ;
85
- } ) ;
86
91
87
92
88
93
} ) ;
0 commit comments