@@ -5,152 +5,39 @@ let chai = require('chai');
5
5
let chaiHttp = require ( 'chai-http' ) ;
6
6
let server = require ( '../app' ) ;
7
7
let should = chai . should ( ) ;
8
+ let intermine = require ( 'imjs' ) ;
8
9
9
10
chai . use ( chaiHttp ) ;
10
11
11
- describe ( 'Fetch' , ( ) => {
12
- describe ( '/GET listing of ontology terms of HumanMine primary classes' , ( ) => {
13
- it ( 'it should GET the listing of ontology terms inside class Protein in HumanMine' , ( done ) => {
14
- chai . request ( server )
15
- . get ( '/fetch/ontologyterms/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein' )
16
- . end ( ( err , res ) => {
17
- res . should . have . status ( 200 ) ;
18
- res . body . results . should . be . a ( 'array' ) ;
19
- res . body . results . length . should . be . at . least ( 1 ) ;
20
- done ( ) ;
21
- } ) ;
22
- } ) ;
23
-
24
- it ( 'it should GET the listing of ontology terms inside class Gene in HumanMine' , ( done ) => {
25
- chai . request ( server )
26
- . get ( '/fetch/ontologyterms/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene' )
27
- . end ( ( err , res ) => {
28
- res . should . have . status ( 200 ) ;
29
- res . body . results . should . be . a ( 'array' ) ;
30
- res . body . results . length . should . be . at . least ( 1 ) ;
31
- done ( ) ;
32
- } ) ;
33
- } ) ;
34
-
35
- it ( 'it should GET the listing of dataset names inside class Protein in HumanMine' , ( done ) => {
36
- chai . request ( server )
37
- . get ( '/fetch/datasets/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein' )
38
- . end ( ( err , res ) => {
39
- res . should . have . status ( 200 ) ;
40
- res . body . results . should . be . a ( 'array' ) ;
41
- res . body . results . length . should . be . at . least ( 1 ) ;
42
- done ( ) ;
43
- } ) ;
44
- } ) ;
45
-
46
- it ( 'it should GET the listing of dataset names inside class Gene in HumanMine' , ( done ) => {
47
- chai . request ( server )
48
- . get ( '/fetch/datasets/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene' )
49
- . end ( ( err , res ) => {
50
- res . should . have . status ( 200 ) ;
51
- res . body . results . should . be . a ( 'array' ) ;
52
- res . body . results . length . should . be . at . least ( 1 ) ;
53
- done ( ) ;
54
- } ) ;
55
- } ) ;
56
-
57
- it ( 'it should GET the listing of pathway names inside class Protein in HumanMine' , ( done ) => {
58
- chai . request ( server )
59
- . get ( '/fetch/pathways/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein' )
60
- . end ( ( err , res ) => {
61
- res . should . have . status ( 200 ) ;
62
- res . body . results . should . be . a ( 'array' ) ;
63
- res . body . results . length . should . be . at . least ( 1 ) ;
64
- done ( ) ;
65
- } ) ;
66
- } ) ;
67
-
68
- it ( 'it should GET the listing of pathway names inside class Gene in HumanMine' , ( done ) => {
69
- chai . request ( server )
70
- . get ( '/fetch/pathways/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene' )
71
- . end ( ( err , res ) => {
72
- res . should . have . status ( 200 ) ;
73
- res . body . results . should . be . a ( 'array' ) ;
74
- res . body . results . length . should . be . at . least ( 1 ) ;
75
- done ( ) ;
76
- } ) ;
77
- } ) ;
78
-
79
- it ( 'it should GET the listing of protein domain names inside HumanMine' , ( done ) => {
80
- chai . request ( server )
81
- . get ( '/fetch/proteindomainname/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice' )
82
- . end ( ( err , res ) => {
83
- res . should . have . status ( 200 ) ;
84
- res . body . results . should . be . a ( 'array' ) ;
85
- res . body . results . length . should . be . at . least ( 1 ) ;
86
- done ( ) ;
87
- } ) ;
88
- } ) ;
89
-
90
- it ( 'it should GET the listing of Participant 2 Gene symbols inside HumanMine' , ( done ) => {
91
- chai . request ( server )
92
- . get ( '/fetch/participant2genesymbols/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice' )
93
- . end ( ( err , res ) => {
94
- res . should . have . status ( 200 ) ;
95
- res . body . results . should . be . a ( 'array' ) ;
96
- res . body . results . length . should . be . at . least ( 1 ) ;
97
- done ( ) ;
98
- } ) ;
99
- } ) ;
100
-
101
- it ( 'it should GET the listing of Diseases Names inside HumanMine' , ( done ) => {
102
- chai . request ( server )
103
- . get ( '/fetch/diseases/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene' )
104
- . end ( ( err , res ) => {
105
- res . should . have . status ( 200 ) ;
106
- res . body . results . should . be . a ( 'array' ) ;
107
- res . body . results . length . should . be . at . least ( 1 ) ;
108
- done ( ) ;
109
- } ) ;
110
- } ) ;
111
-
112
- it ( 'it should GET the listing of Alleles types inside HumanMine' , ( done ) => {
113
- chai . request ( server )
114
- . get ( '/fetch/allelestype/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene' )
115
- . end ( ( err , res ) => {
116
- res . should . have . status ( 200 ) ;
117
- res . body . results . should . be . a ( 'array' ) ;
118
- res . body . results . length . should . be . at . least ( 1 ) ;
119
- done ( ) ;
120
- } ) ;
121
- } ) ;
122
-
123
- it ( 'it should GET the listing of Alleles Clinical Significance inside HumanMine' , ( done ) => {
124
- chai . request ( server )
125
- . get ( '/fetch/clinicalsignificance/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene' )
126
- . end ( ( err , res ) => {
127
- res . should . have . status ( 200 ) ;
128
- res . body . results . should . be . a ( 'array' ) ;
129
- res . body . results . length . should . be . at . least ( 1 ) ;
130
- done ( ) ;
131
- } ) ;
132
- } ) ;
12
+ describe ( 'API requests using imjs' , ( ) => {
13
+ describe ( '/Obtain pathway names in a given class should not be empty' , ( ) => {
14
+ it ( 'it should get the pathway names inside class Gene in HumanMine' , ( done ) => {
15
+
16
+ var service = new intermine . Service ( {
17
+ root : "https://www.humanmine.org/humanmine/service"
18
+ } ) ;
133
19
134
- it ( 'it should GET the listing of Protein Atlas Expression Cell Types inside HumanMine' , ( done ) => {
135
- chai . request ( server )
136
- . get ( '/fetch/proteinatlascelltypes/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene' )
137
- . end ( ( err , res ) => {
138
- res . should . have . status ( 200 ) ;
139
- res . body . results . should . be . a ( 'array' ) ;
140
- res . body . results . length . should . be . at . least ( 1 ) ;
141
- done ( ) ;
142
- } ) ;
143
- } ) ;
20
+ var query = {
21
+ "from" : "Gene" ,
22
+ "select" : [ "pathways.name" , "primaryIdentifier" ] ,
23
+ "model" : {
24
+ "name" : "genomic"
25
+ } ,
26
+ "orderBy" : [ {
27
+ "path" : "pathways.name" ,
28
+ "direction" : "ASC"
29
+ } ]
30
+ } ;
31
+
32
+ var pathways = new intermine . Query ( query , service ) ,
33
+ pathwaysPath = [ query . from , query . select [ 0 ] ] . join ( '.' ) ;
34
+ pathways . summarize ( pathwaysPath ) . then ( function ( pathwaySummary ) {
35
+ //This returns the pathway name and the number of gene rows associated with the pathway
36
+ pathwaySummary . should . be . a ( 'array' ) ;
37
+ pathwaySummary . length . should . be . at . least ( 1 ) ;
38
+ done ( ) ;
39
+ } ) ;
144
40
145
- it ( 'it should GET the listing of Protein Atlas Expression Tissue Names inside HumanMine' , ( done ) => {
146
- chai . request ( server )
147
- . get ( '/fetch/proteinatlastissuenames/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene' )
148
- . end ( ( err , res ) => {
149
- res . should . have . status ( 200 ) ;
150
- res . body . results . should . be . a ( 'array' ) ;
151
- res . body . results . length . should . be . at . least ( 1 ) ;
152
- done ( ) ;
153
- } ) ;
154
41
} ) ;
155
42
} ) ;
156
43
} ) ;
0 commit comments