Skip to content

Commit

Permalink
format example code
Browse files Browse the repository at this point in the history
change info color with yellow
  • Loading branch information
xqbumu committed Feb 5, 2018
1 parent 6f8f9c9 commit 33b981a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ const app = require('@rokid/ams')();
app.on('request', (data) => {
// handler
});
app.start();
app.start();
24 changes: 14 additions & 10 deletions example/tests/cloud-confirm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,40 @@ test('test 7 play', (t) => {
'intent': 'play_random',
'pattern': '^$iwant?$play$one?$keyword$',
'slots': {}
}, {
'appId':'RCAC74F187F34C94B93EE3BAECFCE2E3',
'response': {
}, {
'appId': 'RCAC74F187F34C94B93EE3BAECFCE2E3',
'response': {
'action': {
'version': '2.0.0',
'type': 'NORMAL',
'form': 'scene',
'shouldEndSession': true,
'directives': [{
'type':'voice',
'type': 'voice',
'action': 'PLAY',
'disableEvent':false,
'disableEvent': false,
'item': {
'itemId':'newstestitemid',
'itemId': 'newstestitemid',
'tts': '晚上好,若琪为您播放晚间新闻摘要,首先我们来看看社会新闻。'
}
}, {
'type':'confirm',
'type': 'confirm',
'confirmIntent': 'nlp intent to confirm',
'confirmSlot': 'nlp slot to confirm',
'optionWords': ['word1', 'word2']
}]
}
},
'startWithActiveWord':false,
'version':'2.0.0'
'startWithActiveWord': false,
'version': '2.0.0'
});

Promise.all([
t.assert('Voice.FINISHED', {voice: {item: 'newstestitemid'}}),
t.assert('Voice.FINISHED', {
voice: {
item: 'newstestitemid'
}
}),
t.assert('siren.statechange', 'open'),
]).then(() => {
t.done();
Expand Down
5 changes: 3 additions & 2 deletions lib/executor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const asserts = [];
const filter = process.argv[2];
const redify = (text) => '\033[31m' + text + '\033[0m';
const greyify = (text) => '\033[1;30m' + text + '\033[0m';
const yellowify = (text) => '\033[33m' + text + '\033[0m';
const greenify = (text) => '\033[32m' + text + '\033[0m';

class TestCase {
Expand Down Expand Up @@ -149,11 +150,11 @@ dispatcher.on('line', (line) => {
}
const item = asserts[0];
if (!item) {
console.info(greyify(` .skip ${name} ${JSON.stringify(val)}`));
console.info(yellowify(` .skip ${name} ${JSON.stringify(val)}`));
return;
}
if (item.name !== name) {
console.info(greyify(` .skip ${name} ${JSON.stringify(val)}`));
console.info(yellowify(` .skip ${name} ${JSON.stringify(val)}`));
return;
}
asserts.shift();
Expand Down

0 comments on commit 33b981a

Please sign in to comment.