/angular-hangman-tdd

Hangman game written in angular using TDD methodology

Primary LanguageJavaScript

Angular Hangman TDD Demo

  1. Abstract
  2. Installation
  3. Usage
  4. Game API
  5. Technology stack
  6. Demo
  7. Tests

Abstract

I wrote this project as a demo project for a talk give titled "TDD in javascript - Not a myth" It was written TDD mode from scracth using yeoman wix-angular generator

This project features:

  • Unit testing using jasmine
    • Testing http requests and mocking their responses
  • E2E testing using protractor
    • Using angular ngMockE2E module for writing mock server
  • Building mocks for various services

And more..

Installation

After you cloned this project, navigate into the project folder and run the following commands in the shell

npm install
bower install
bundle install
grunt serve

Usage

  1. run grunt serve in your root directory of the project
  2. open http://localhost:9000
  3. switch to mobile mode (in chrome dev tools press the mobile icon on the top left corner)

Game API

To demonstrate how to work with a server the game call 2 endpoints.

  • GET /api/categories
    • Returns array of all categories keys

Response Example:

['famousCats', 'capitals', 'movies', 'popes']
  • GET /api/categories/{{category}}/words
    • Returns array of phrases in that category

Response Example:

['Francis', 'Benedict XVI', 'St John Paul II']

Technology stack

  • Package managers:
    • Bower
    • npm
  • Testing:
    • karma - test runner
    • jasmine - js testing framework
    • protractor - e2e tests
    • phantomjs - headless browser
  • Build tools:
    • grunt
    • yeoman

Demo

Coming soon

Tests

For unit tests please see test/spec folder.

For E2E tests please see test/e2e/spec folder.