Skip to content

Commit

Permalink
fix: тестилка иногда брала для проверки сообщение клиента
Browse files Browse the repository at this point in the history
Конкретно при ответе, который завершает сессию
  • Loading branch information
popstas committed Jul 8, 2018
1 parent 1f2281b commit a7d1c62
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ export const getters = {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
return S4() + S4() + '-' + S4() + '-' + S4() + '-' + S4() + '-' + S4() + S4() + S4();
},

lastBotMessage(state) {
for(let i = state.messages.length - 1; i >= 0; i--){
if(state.messages[i].author == 'Робот') return state.messages[i];
}
}
};

Expand Down Expand Up @@ -311,7 +317,7 @@ export const actions = {
});
},

async [RUN_TEST]({ dispatch, state, commit }, dialogs) {
async [RUN_TEST]({ dispatch, getters, commit }, dialogs) {
let allFailedTests = [];

// test suites (one dialog - one button)
Expand Down Expand Up @@ -343,7 +349,7 @@ export const actions = {
isUser = !isUser;

// check bot's answer
let msg = state.messages[state.messages.length - 1];
let msg = getters.lastBotMessage;

// simple equals string
if (typeof message === 'string') {
Expand Down

0 comments on commit a7d1c62

Please sign in to comment.