Giter VIP home page Giter VIP logo

technical_test_angular-lotery_game's Introduction

Technical_test_Angular-Lotery_game

Technical Test in Angular about a lottery game. Angular12, Karma Jasmine for testing and deployed in firebase.

Firebase deploy: https://angular-prueba-tecnica-loteria.web.app/ integrated with GitHub actions so it get deployed with every git push.

Configurable parameters

The project have the following configurable attributes, you can modify the values in the enviroment file, creating multiple enviroments easily for multiple configurations the path is "src\environments\environment.ts" and "src\environments\environment.prod.ts" ย (develop and production enviroment)

  • ballNumber: Number of balls (default : 10)
  • arrayColours: The colors of the balls in an array, if there are more balls than colors it will iterate the array (default: ["#f79256","#fbd1a2","#7dcfb6","#00b2ca","#ff99c8"] )
  • maxNumberOfBalls: Max number of balls allowed to pick (default: 8)
  • profit: The profit if you win (default: 1.5) These values are shared to the component using the configuration.service.ts

Components:

  • ParentComponent: It controls the responsive and is the enter point to the application
  • BallSelectorComponent: It contains the balls component and show the results when the game is over.
  • BallComponent: It is the balls that can be selected, it comunicate to the betSlipComponent adding or removing balls, also can be disabled by a subscription and have a little animation when clicked or reseted.
  • BetSlipComponent: It controls the balls selected and all the currency logic. It communicates to the rest of the components, sending info about the actual status of the game.

Component communication

For the communication between components, the application uses a main service and Subjects which are a special type of observer that allows us to communicate to multiple components simultaneously.

There are 3 subjects:

  • Subjectballs : Control when a new ball is selected, and clear the balls if the reset or restart button is pressed.
  • SubjectDisable: Control if balls have to be disabled because the max number of balls have been reached.
  • SubjectPlaying: Is activate when the game is playing, just after pushing the place bet button. It also sends the results to the ball selector component.

Testing:

Using Karma Jasmine components and services are tested automatically. The results are:

KarmaResults

technical_test_angular-lotery_game's People

Contributors

alejandromonteseirin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.