-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
25 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import request from 'request-promise'; | ||
|
||
const brainURL = process.env.LUIS_APP_URL; | ||
|
||
const query = (text) => { | ||
const url = `${brainURL}&q=${text}`; | ||
return request(url).then(body => { | ||
return(JSON.parse(body)); | ||
}); | ||
}; | ||
|
||
export { | ||
brainURL, | ||
query | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import test from 'ava'; | ||
|
||
const brainURL = process.env.LUIS_APP_URL; | ||
import * as luis from 'lib/luis'; | ||
|
||
test('Evironment var for the Luis app is set', t => { | ||
t.truthy(brainURL); | ||
t.truthy(luis.brainURL); | ||
}); | ||
|
||
test.skip('GET on Luis URL returns a JSON', t => { | ||
t.pass(); | ||
test('GET on Luis URL returns an object', t => { | ||
return luis.query('').then(result => { | ||
t.is(typeof result, 'object'); | ||
}).catch( err => { | ||
t.is(err.statusCode, 200); | ||
});; | ||
}); | ||
|
||
test.todo('Get on the Luis url returns a JSON'); |