1.0.0-g • Published 4 years ago

mock-applicationmashup v1.0.0-g

Weekly downloads
23
License
Apache-2.0
Repository
github
Last release
4 years ago

MashupPlatform API mock

Build Status Coverage Status

A JavaScript mock library for the Application Mashup's Widget API. This library aims to make testing WireCloud widgets and operators as simple as possible.

Installation

  • Using npm

    npm install mock-applicationmashup
  • Using bower

    bower install mock-applicationmashup

Using it in your tests

MockMP is a drop in replacement for the MashupPlatform global object found when running widgets and operators in the WireCloud platform. To replace it, you will have to set it into the window object:

window.MashupPlatform = new MockMP({
    type: "widget"
});

Once installed, you will be able to use MashupPlatform as if your code were running inside WireCloud. This MashupPlatform object is built using jasmine spies, providing support for evaluating how they are called.

Some of those spies are configured to provide a basic behaviour simulating that you are running inside WireCloud. For example, MashupPlatform.prefs.get will throw an exception for non existing preferences. The list of available preferences is configured through the MockMP constructor. The available options are:

  • type: type of component to mockup: widget or operator.
  • prefs: object providing the available preferences and the default values.
  • inputs: list of available input enpdoints.
  • outputs: list of available output endpoints.
  • context: object providing the available platform context and the default values.

Sorry, documentation in progress, will be updated as soon as possible

1.0.0-g

4 years ago

1.0.0-f

5 years ago

1.0.0-e

6 years ago

1.0.0-d

6 years ago

1.0.0-c

8 years ago

1.0.0-b

8 years ago

1.0.0-a

8 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.9

9 years ago