@@ -225,46 +225,107 @@ describe('Unit Tests - Models', () => {
225225 . catch ( errorHandler . bind ( done ) ) ;
226226 } ) ;
227227
228- it ( 'Gets model inputs' , done => {
229- mock . onGet ( BASE_URL + '/v2/models/%40modelID/inputs' ) . reply ( 200 , JSON . parse ( `
228+ it ( 'Get model outputinfo' , done => {
229+ mock . onGet ( BASE_URL + '/v2/models/%40modelID/output_info' ) . reply ( 200 , JSON . parse ( `
230+ {
231+ "status": {
232+ "code": 10000,
233+ "description": "Ok"
234+ },
235+ "model": {
236+ "id": "@modelID",
237+ "name": "@modelName",
238+ "created_at": "2017-05-16T19:20:38.733764Z",
239+ "app_id": "main",
240+ "output_info": {
241+ "data": {
242+ "concepts": [{
243+ "id": "@conceptID11",
244+ "name": "safe",
245+ "created_at": "2017-05-16T19:20:38.450157Z",
246+ "language": "en",
247+ "app_id": "main"
248+ }]
249+ },
250+ "type": "concept",
251+ "type_ext": "concept"
252+ },
253+ "model_version": {
254+ "id": "@modelVersionID",
255+ "created_at": "2017-05-16T19:20:38.733764Z",
256+ "status": {
257+ "code": 21100,
258+ "description": "Model trained successfully"
259+ },
260+ "active_concept_count": 5
261+ },
262+ "display_name": "Moderation"
263+ }
264+ }
265+ ` ) ) ;
266+
267+ app . models . getOutputInfo ( '@modelID' )
268+ . then ( outputinfo => {
269+ expect ( mock . history . get . length ) . toBe ( 1 ) ;
270+
271+ expect ( outputinfo . id ) . toBe ( "@modelID" ) ;
272+ expect ( outputinfo . name ) . toBe ( "@modelName" ) ;
273+ expect ( outputinfo . modelVersion . id ) . toBe ( "@modelVersionID" ) ;
274+ expect ( outputinfo . outputInfo . type ) . toBe ( "concept" ) ;
275+ done ( ) ;
276+ } )
277+ . catch ( errorHandler . bind ( done ) ) ;
278+ } ) ;
279+
280+ it ( 'Gets model' , done => {
281+ mock . onGet ( BASE_URL + '/v2/models/%40modelID' ) . reply ( 200 , JSON . parse ( `
230282{
231283 "status": {
232284 "code": 10000,
233285 "description": "Ok"
234286 },
235- "inputs": [{
236- "id": "@inputID",
237- "data": {
238- "image": {
239- "url": "@imageURL"
287+ "model": {
288+ "id": "@modelID",
289+ "name": "@modelName",
290+ "created_at": "2017-05-16T19:20:38.733764Z",
291+ "app_id": "main",
292+ "output_info": {
293+ "data": {
294+ "concepts": [{
295+ "id": "@conceptID11",
296+ "name": "safe",
297+ "created_at": "2017-05-16T19:20:38.450157Z",
298+ "language": "en",
299+ "app_id": "main"
300+ }]
240301 },
241- "concepts": [{
242- "id": "@conceptID",
243- "name": "@conceptName",
244- "value": 1,
245- "app_id": "@conceptAppID"
246- }]
302+ "type": "concept",
303+ "type_ext": "concept"
247304 },
248- "created_at": "2017-10-15T16:30:52.964888Z",
249- "status": {
250- "code": 30000,
251- "description": "Download complete"
252- }
253- }]
305+ "model_version": {
306+ "id": "@modelVersionID",
307+ "created_at": "2017-05-16T19:20:38.733764Z",
308+ "status": {
309+ "code": 21100,
310+ "description": "Model trained successfully"
311+ },
312+ "active_concept_count": 5
313+ },
314+ "display_name": "Moderation"
315+ }
254316}
255317 ` ) ) ;
256318
257- app . models . initModel ( '@modelID' ) . then ( model => {
258- return model . getInputs ( ) ;
259- } ) . then ( inputsResponse => {
260- expect ( mock . history . get . length ) . toBe ( 1 ) ;
261-
262- const input = inputsResponse [ 'inputs' ] [ 0 ] ;
263- expect ( input . id ) . toBe ( '@inputID' ) ;
264- expect ( input . data . concepts [ 0 ] . id ) . toBe ( '@conceptID' ) ;
265-
266- done ( ) ;
267- } ) . catch ( errorHandler . bind ( done ) ) ;
319+ app . models . get ( '@modelID' ) . then ( model => {
320+ expect ( mock . history . get . length ) . toBe ( 1 ) ;
321+
322+ expect ( model . id ) . toBe ( '@modelID' ) ;
323+ expect ( model . name ) . toBe ( '@modelName' ) ;
324+ expect ( model . modelVersion . id ) . toBe ( '@modelVersionID' ) ;
325+ expect ( model . outputInfo . data . concepts [ 0 ] . id ) . toBe ( '@conceptID11' ) ;
326+ done ( ) ;
327+ } )
328+ . catch ( errorHandler . bind ( done ) ) ;
268329 } ) ;
269330
270331 it ( 'Modifies models' , done => {
0 commit comments