项目作者: scastrec

项目描述 :
An Alexa skill for the FIFA Worldcup
高级语言: JavaScript
项目地址: git://github.com/scastrec/FIFAWorldCupSkill.git
创建时间: 2018-04-30T13:18:29Z
项目社区:https://github.com/scastrec/FIFAWorldCupSkill

开源协议:

下载


Foot World Cup Alexa Skill

With this skill, you can ask informations abot FIFA Worldcup 2018.

Functionalities

  • Où se déroule la coupe du monde ?
  • Quand début la coupe du monde ?
  • Combien de matches se dérouleront à la coupe du monde ?
  • Combien de match restent ils ?
  • Combien de match restent pour la france ?
  • Quand se joue le prochain match de l’équipe de France ?
  • Quand se joue la finale?

Structure

  • data : Folder that contains FIFA Worldcup data
  • test : Lambda tests folder used by mocha
  • SkillManifest.json : Skill to import in Alexa console
  • Other files : Lambda function. index.html is the input.

Testing

AWS Testing

In the AWS Lambda page you will find events tests. Every function in your lambda HAVE TO be tested this way. It enables developers to :

  • Understand your lambda
  • Know the input/output
  • Be sure that your lambda works
  • Have a set of test data

Local testing

Unit Testing

Libraries

To unit test, there is some libraries:

  • mocha: Mocha is a feature-rich JavaScript test framework.
  • chai: Assertion library for NodeJS.
  • LambdaTester: A simple lib to tests Lambda.
How to use it

Run the command mocha in your terminal. It will run every test available in the /test directory.

  1. Simple unit tests sample
    In this sample, we test the dataExtractor functions.
    First, we have a test description. For this description, we add multiple tests in the it section. Then, we assert in the callback with chai.

    1. describe( 'nextMatch', function() {
    2. it( `nextMatch Error`, function() {
    3. return LambdaTester( myLambda.handler )
    4. .event(nextMatchMock)
    5. .expectResult( ( result ) => {
    6. console.log(result);
    7. expect( result.response.outputSpeech.ssml).to.equal(
    8. "<speak>Le prochain match a lieu le 21 juin à 20h00 heure locale (17H à Paris). Il s'agit de France contre Pérou</speak>"
    9. );
    10. });
    11. });
    12. });

TODO

  1. Add more skills
  2. Add english version
  3. Suivi des scores
  4. Extends lambda to be able to respond to Facebook messenger and Google Home.