Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.

Commit 52b942a

Browse files
authored
Merge pull request #1 from mocks-server/v1.0.0
V1.0.0
2 parents 41355ff + b0ad357 commit 52b942a

File tree

122 files changed

+375
-9273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+375
-9273
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# tests
1010
/coverage
1111
/mocks
12-
/test/acceptance/main/fixtures/files-watch
12+
/test/acceptance/fixtures/files-watch
1313

1414
# misc
1515
.DS_Store

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ script:
1919
- npm run lint
2020
- npm run test-ci
2121
- npm run coveralls
22-
- sonar-scanner -Dsonar.login=${SONAR_TOKEN}
22+
- 'if [ -n "$SONAR_TOKEN" ]; then sonar-scanner -Dsonar.login=${SONAR_TOKEN}; fi'
2323

2424
deploy:
2525
provider: npm

CHANGELOG.md

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,61 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [To be deprecated]
8-
- Deprecate options "features" and "feature".
98
- Remove "/features" api path.
10-
- Remove "features" getter from Server
11-
- Remove Server and Cli constructors. Use @mocks-server/core instead
129

1310
## [unreleased]
1411
### Added
1512
### Changed
1613
### Fixed
1714
### Removed
1815

19-
## [1.3.0] - 2019-11-17
20-
### Added
21-
- Add programmatic Classes end-to-end tests
22-
- Add files watcher end-to-end tests
23-
24-
### Changed
25-
- Full refactor for making it pluggable.
26-
- Split code into core, cli and api main Classes, which are intended to be published separately.
27-
28-
## [1.2.0] - 2019-11-13
29-
### Added
30-
- Add api acceptance tests
31-
32-
### Changed
33-
- Upgrade dependencies
34-
35-
### Fixed
36-
- Catch server.listen error and reject start method promise with it when occurs.
37-
38-
## [1.1.1] - 2019-11-12
39-
### Changed
40-
- Change readme. Add links to docs website.
41-
42-
## [1.1.0] - 2019-11-08
43-
### Changed
44-
- Change "feature" concept by "behavior". Maintain old "feature" options and urls as aliases for maintaining compatibility.
45-
- Upgrade dependencies
46-
47-
## [1.0.3] - 2019-11-08
48-
### Fixed
49-
- Fix examples and badges in readme.
50-
51-
## [1.0.2] - 2019-11-08
52-
### Changed
53-
- Project forked from xbyorange/mocks-server. Fixed license. Read NOTICE for further details
54-
55-
### Fixed
56-
- Fix some minor Sonar bugs and code smells.
57-
58-
## [1.0.1] - 2019-06-04
59-
### Fixed
60-
- Upgrade dependencies to fix potential security vulnerability
61-
- Bind winston tracer methods to winston tracer instance to fix an issue produced by new Winston version as described in: https://github.com/winstonjs/winston/issues/1577
62-
63-
## [1.0.0] - 2019-06-04
64-
### Changed
65-
- Forked from xbyorange mocks-server gitlab private repository.
16+
## [1.0.0] - 2019-12-06
17+
- Migrate administration api from [@mocks-server/main, v1.3.0](https://github.com/mocks-server/main/releases/tag/v1.3.0). For further info read the [previous repository CHANGELOG.md](https://github.com/mocks-server/main/blob/v1.3.0/CHANGELOG.md#130---2019-11-17)
18+
- Export Plugin, which can be used only programmatically. (Binary is still distributed in the [@mocks-server/main](https://github.com/mocks-server/main) package).
19+
- Remove core and inquirer-cli. Both have now their own repositories.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,5 +175,5 @@
175175

176176
END OF TERMS AND CONDITIONS
177177

178-
Copyright 2019 Javier Brea and contributors
178+
Copyright 2019 Javier Brea
179179
Copyright 2019 XbyOrange

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mocks-server. Main distributable
1+
mocks-server admin-api plugin.
22
Copyright 2019 Javier Brea
33

44
Portions of this software were developed at XbyOrange company.

README.md

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,51 @@
55
[![NPM downloads][npm-downloads-image]][npm-downloads-url] [![License][license-image]][license-url]
66

77

8-
# [![Mocks Server][logo-url]][website-url] Mocks Server
8+
# [![Mocks Server][logo-url]][website-url] Mocks Server Plugin Admin Api
99

10-
This package provides a server that simulates API behaviors. It can be added as a dependency of your project, and started simply running an NPM command.
10+
Plugin for [Mocks Server][website-url] that provides an API REST that allows to change dinamically the current behavior, change delay time, and another [Mocks Server options][options-url].
1111

12-
## Documentation
12+
This is __very useful when running acceptance tests, as you can change the behavior of the api__ simply making an HTTP request in your tests `before` method, for example.
1313

14-
Please refer to the [project documentation website][website-url]:
14+
## Usage
1515

16-
* [Get started](https://www.mocks-server.org/docs/get-started-intro)
17-
* [Tutorials](https://www.mocks-server.org/docs/tutorials-static)
18-
* [Configuration](https://www.mocks-server.org/docs/configuration-command-line-arguments)
16+
This plugin is included in the [main distribution of the Mocks Server project][main-distribution-url], so you can refer to the [official documentation website][website-url].
1917

20-
## Why a mocks server?
18+
## API Resources
2119

22-
Controlling the responses of the api will improve the front-end development workflow, avoiding early dependencies with back-end. It also improves the testing and development of error cases or another cases that are commonly hard to reproduce in the real api.
20+
Available api resources are:
2321

24-
Defining the api responses during the earliest phases of development will improve the communication among team members and align their expectations.
25-
26-
Working with Node.js, it integrates better in front-end projects as any other NPM dependency, and it will be easier for front-end developers to maintain the mocks.
22+
* `GET` `/mocks/behaviors/current` Returns current behavior.
23+
* `PUT` `/mocks/behaviors/current` Set current behavior.
24+
* Request body example: `{ "name": "behavior-name" }`
25+
* `GET` `/mocks/settings` Returns current server settings.
26+
* Response body example: `{ "delay": 0 }`
27+
* `PUT` `/mocks/settings` Changes current server settings.
28+
* Request body example: `{ "delay": 3000 }`
2729

2830
## Contributing
2931

3032
Contributors are welcome.
3133
Please read the [contributing guidelines](.github/CONTRIBUTING.md) and [code of conduct](.github/CODE_OF_CONDUCT.md).
3234

3335
[website-url]: https://www.mocks-server.org
36+
[main-distribution-url]: https://www.npmjs.com/package/@mocks-server/main
37+
[options-url]: https://www.mocks-server.org/docs/configuration-options
3438
[logo-url]: https://www.mocks-server.org/img/logo_120.png
35-
[inquirer-url]: https://www.npmjs.com/package/inquirer#support-os-terminals
36-
[inquirer-support]: https://www.npmjs.com/package/inquirer#support-os-terminals
37-
38-
[coveralls-image]: https://coveralls.io/repos/github/mocks-server/main/badge.svg
39-
[coveralls-url]: https://coveralls.io/github/mocks-server/main
40-
[travisci-image]: https://travis-ci.com/mocks-server/main.svg?branch=master
41-
[travisci-url]: https://travis-ci.com/mocks-server/main
42-
[last-commit-image]: https://img.shields.io/github/last-commit/mocks-server/main.svg
43-
[last-commit-url]: https://github.com/mocks-server/main/commits
44-
[license-image]: https://img.shields.io/npm/l/@mocks-server/main.svg
45-
[license-url]: https://github.com/mocks-server/main/blob/master/LICENSE
46-
[npm-downloads-image]: https://img.shields.io/npm/dm/@mocks-server/main.svg
47-
[npm-downloads-url]: https://www.npmjs.com/package/@mocks-server/main
48-
[npm-dependencies-image]: https://img.shields.io/david/mocks-server/main.svg
49-
[npm-dependencies-url]: https://david-dm.org/mocks-server/main
50-
[quality-gate-image]: https://sonarcloud.io/api/project_badges/measure?project=mocks-server-main&metric=alert_status
51-
[quality-gate-url]: https://sonarcloud.io/dashboard?id=mocks-server-main
52-
[release-image]: https://img.shields.io/github/release-date/mocks-server/main.svg
53-
[release-url]: https://github.com/mocks-server/main/releases
39+
40+
[coveralls-image]: https://coveralls.io/repos/github/mocks-server/plugin-admin-api/badge.svg
41+
[coveralls-url]: https://coveralls.io/github/mocks-server/plugin-admin-api
42+
[travisci-image]: https://travis-ci.com/mocks-server/plugin-admin-api.svg?branch=master
43+
[travisci-url]: https://travis-ci.com/mocks-server/plugin-admin-api
44+
[last-commit-image]: https://img.shields.io/github/last-commit/mocks-server/plugin-admin-api.svg
45+
[last-commit-url]: https://github.com/mocks-server/plugin-admin-api/commits
46+
[license-image]: https://img.shields.io/npm/l/@mocks-server/plugin-admin-api.svg
47+
[license-url]: https://github.com/mocks-server/plugin-admin-api/blob/master/LICENSE
48+
[npm-downloads-image]: https://img.shields.io/npm/dm/@mocks-server/plugin-admin-api.svg
49+
[npm-downloads-url]: https://www.npmjs.com/package/@mocks-server/plugin-admin-api
50+
[npm-dependencies-image]: https://img.shields.io/david/mocks-server/plugin-admin-api.svg
51+
[npm-dependencies-url]: https://david-dm.org/mocks-server/plugin-admin-api
52+
[quality-gate-image]: https://sonarcloud.io/api/project_badges/measure?project=mocks-server-plugin-admin-api&metric=alert_status
53+
[quality-gate-url]: https://sonarcloud.io/dashboard?id=mocks-server-plugin-admin-api
54+
[release-image]: https://img.shields.io/github/release-date/mocks-server/plugin-admin-api.svg
55+
[release-url]: https://github.com/mocks-server/plugin-admin-api/releases

assets/cli_animation.gif

-1010 KB
Binary file not shown.

bin/mocks-server

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/cli.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

index.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ Unless required by applicable law or agreed to in writing, software distributed
1111

1212
"use strict";
1313

14-
const ProgrammaticCli = require("./lib/ProgrammaticCli");
15-
const ProgrammaticServer = require("./lib/ProgrammaticServer");
16-
const Behavior = require("./lib/core/mocks/Behavior");
14+
const PluginAdminApi = require("./src/Api");
1715

18-
module.exports = {
19-
Cli: ProgrammaticCli,
20-
Server: ProgrammaticServer,
21-
Feature: Behavior,
22-
Behavior
23-
};
16+
module.exports = PluginAdminApi;

0 commit comments

Comments
 (0)