Skip to content

Commit

Permalink
fix: shuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
fletcherist committed Aug 12, 2018
1 parent f71db67 commit e5cb122
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/testUtils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { WebhookRequest } from '../yandex/response';
export const generateRequest = (
commandText,
utteranceText?,
): WebhookRequest => ({
// import { WebhookRequest } from '../yandex/response';
export const request = (commandText, utteranceText?): WebhookRequest => ({
meta: {
client_id: 'Developer Console',
locale: 'ru-RU',
Expand All @@ -22,3 +19,13 @@ export const generateRequest = (
},
version: '1.0',
});

export function shuffle(arr) {
return arr.sort(function() {
return 0.5 - Math.random();
});
}
export function getRandomText() {
const words = ['ek', 'ong', 'kar', 'sat', 'gur', 'prasad'];
return shuffle(words).join(' ');
}

0 comments on commit e5cb122

Please sign in to comment.