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

Commit 7d7a2a0

Browse files
authored
Merge pull request #93 from mocks-server/release
Release v2.0.0
2 parents 0bce1ff + afae700 commit 7d7a2a0

File tree

80 files changed

+2215
-4202
lines changed

Some content is hidden

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

80 files changed

+2215
-4202
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches:
55
- master
66
- release
7+
- pre-release
78
pull_request:
89
jobs:
910
test:
@@ -38,8 +39,6 @@ jobs:
3839
run: npm ci
3940
- name: Lint
4041
run: npm run lint
41-
- name: Test unit
42-
run: npm run test:unit
4342
- name: Test E2E
4443
run: npm run test:e2e
4544
id: test-e2e

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
# tests
1010
/coverage
1111
/mocks
12-
/test/e2e/fixtures/files-watch
12+
/test/e2e/fixtures/temp
13+
/test/e2e/fixtures/mocks.config.js
1314

1415
# misc
1516
.DS_Store

CHANGELOG.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,50 @@ 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-
- Remove deprecated "/mocks" api path.
9-
- Remove property "name" from behavior model.
108

119
## [unreleased]
1210
### Added
1311
### Changed
1412
### Fixed
1513
### Removed
1614

15+
## [2.0.0] - 2021-02-17
16+
17+
### Added
18+
- Add mocks, routes, routes-variants and mock-custom-routes-variants apis
19+
20+
### Changed
21+
- feat: Move behaviors and fixtures apis under legacy folder
22+
- refactor: Use helper to create routers with same structure
23+
- chore(deps): Update dependencies
24+
25+
### Removed
26+
- Remove deprecated api paths
27+
- Remove adminApiDeprecatedPaths option.
28+
29+
### BREAKING CHANGES
30+
- Move behaviors and fixtures apis under legacy folder
31+
- Remove deprecated api paths
32+
- Remove adminApiDeprecatedPaths option.
33+
34+
## [2.0.0-beta.2] - 2021-02-16
35+
36+
### Changed
37+
- chore(deps): Update mocks-server/core dependency. Adapt tests.
38+
39+
## [2.0.0-beta.1] - 2021-02-14
40+
41+
### Added
42+
- Add mocks, routes, routes-variants and mock-custom-routes-variants apis
43+
44+
### Changed
45+
- Move behaviors and fixtures apis under legacy folder
46+
- refactor: Use helper to create routers with same structure
47+
48+
### Removed
49+
- Remove deprecated api paths
50+
- Remove adminApiDeprecatedPaths option.
51+
1752
## [1.5.0] - 2020-12-25
1853

1954
### Added

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,46 @@
77

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

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].
10+
Plugin for [Mocks Server][website-url] that provides an API REST that allows to change the current behavior, change delay time, and another [Mocks Server options][options-url].
1111

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.
12+
This is __very useful when running acceptance tests, as you can change the current mock__ simply with a HTTP request in the `before` method of your tests, for example.
13+
14+
A __client for the administration api__ is also distributed as a separated package: [@mocks-server/admin-api-client](https://www.npmjs.com/package/@mocks-server/admin-api-client).
1315

1416
## Usage
1517

1618
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].
1719

1820
## Options
1921

20-
* `adminApiPath` - Base path for the administration api. Default is "/admin". You should change it only if there is any conflict with the api you are mocking.
21-
* `adminApiDeprecatedPaths` - Boolean option, disables deprecated "/mocks" api path, which is still enabled by default.
22+
* __`adminApiPath`__ _(String)_: Path for the administration api. Default is `/admin`. You should change it only in case there is any conflict with the api you are mocking.
2223

23-
Read more about [how to define options for the mocks-server plugins here](https://www.mocks-server.org/docs/configuration-options).
24+
Read more about [how to set options in Mocks Server here](https://www.mocks-server.org/docs/configuration-options).
2425

2526
## API Resources
2627

2728
Available api resources are:
2829

29-
* `GET` `/admin/about` Returns plugin information.
30+
* `GET` `/admin/about` Returns "plugin-admin-api" information.
3031
* Response body example: `{ "version": "1.2.0" }`
31-
* `GET` `/admin/behaviors` Returns behaviors collection.
32-
* `GET` `/admin/behaviors/:id` Returns an specific behavior.
33-
* `GET` `/admin/fixtures` Returns fixtures collection.
34-
* `GET` `/admin/fixtures/:id` Returns an specific fixture.
32+
* `GET` `/admin/mocks` Returns mocks.
33+
* `GET` `/admin/mocks/:id` Returns a specific mock.
34+
* `GET` `/admin/routes` Returns routes collection.
35+
* `GET` `/admin/routes/:id` Returns a specific route.
36+
* `GET` `/admin/routes-variants` Returns routes variants collection.
37+
* `GET` `/admin/routes-variants/:id` Returns a specific route variant.
38+
* `GET` `/admin/mock-custom-routes-variants` Returns an array of currently custom routes variants ids.
39+
* `POST` `/admin/mock-custom-routes-variants` Defines a route variant to be used by current mock.
40+
* Request body example: `{ "id": "users:error" }`
41+
* `DELETE` `/admin/mock-custom-routes-variants` Restore routes variants to those defined in current mock.
3542
* `GET` `/admin/settings` Returns current server settings.
36-
* Response body example: `{ "delay": 0, behavior: "foo-behavior", path: "mocks" }`
43+
* Response body example: `{ "delay": 0, mock: "foo-mock", path: "mocks" }`
3744
* `PATCH` `/admin/settings` Changes current server settings.
3845
* Request body example: `{ "delay": 3000 }`
46+
* `GET` `/admin/alerts` Returns current alerts.
47+
* `GET` `/admin/alerts/:id` Returns a specific alert. The alert `id` is equivalent to the alert `context` _(read the [developing plugins chapter](plugins-developing-plugins.md) for further info about alerts)_.
3948

40-
> Deprecated api resources under "/mocks" api path are still available.
49+
> v1.x deprecated api resources are also still available under the `/legacy` path.
4150
4251
## Contributing
4352

jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ module.exports = {
2525
},
2626

2727
// The glob patterns Jest uses to detect test files
28-
testMatch: ["<rootDir>/test/unit/**/*.spec.js"],
29-
// testMatch: ["<rootDir>/test/unit/**/Plugin.spec.js"],
28+
testMatch: ["<rootDir>/test/e2e/**/*.spec.js"],
29+
// testMatch: ["<rootDir>/test/e2e/**/legacy-behaviors-api.spec.js"],
3030

3131
// The test environment that will be used for testing
3232
testEnvironment: "node",

jest.e2e.config.js

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

0 commit comments

Comments
 (0)