Git Product home page Git Product logo

global-weather's Introduction

NPM Distributed Tests

Introduction

All the countries in the world have decided that they want to create a unified way of collecting weather information.
Each country is responsible for providing a service that allows users to request weather information. The services will provide 3 functions:

currentTemp();
currentWind();
currentRain();

As part of this agreement, a collection of tests has been created in 'test-weather-service' packages.
Each country is required to create a service that passes these tests.
I have created two services 'uk-weather-service' and 'usa-weather-service' that depend on 'test-weather-service'.
This repo is a example of how to layout distributed tests.

test-weather-service

The test-weather-service requires a service that is tobe tested tobe injected on this line.

exports.testApi = function (apiClient)

Implementing the tests

You will need to add the package test-weather-service.

npm install --save file:..\\test-weather-service

Created the test file 'test/test.js'.
This is the default file that 'Mocha' will use to run tests.
That file 'pulls' in the dependency on the 'test-weather-server' like this:

var testWeatherService = require('test-weather-service');

We then create a instance of the service we want to test and inject it into the tests.

var client = require('../index.js');

it('should return 0 when all tests have completed (Does not mean all tests have passed)', function () {
    
    //Run all the tests define in the test-weather-service package
    assert.equal(testWeatherService.testApi(client), 0);
     
});

You can then run the tests in by running mocha.

global-weather's People

Contributors

mikebateman 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.