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

Commit 2234af8

Browse files
authored
Merge pull request #92 from mocks-server/pre-release
release v2.0.0
2 parents 7b2c3fd + 57e6046 commit 2234af8

82 files changed

Lines changed: 1499 additions & 12011 deletions

File tree

Some content is hidden

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

.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

.github/workflows/publish-to-github.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
registry-url: 'https://npm.pkg.github.com'
1414
# Defaults to the user or organization that owns the workflow file
1515
scope: '@mocks-server'
16-
- run: npm publish
16+
- run: npm publish --tag beta
1717
env:
1818
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish-to-npm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
with:
1212
node-version: '12.x'
1313
registry-url: 'https://registry.npmjs.org/'
14-
- run: npm publish
14+
- run: npm publish --tag beta
1515
env:
1616
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.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: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,31 @@ 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
15-
- docs(readme): Add missed API resources.
1613
### Removed
1714

15+
## [2.0.0-beta.2] - 2021-01-16
16+
17+
### Changed
18+
- chore(deps): Update mocks-server/core dependency. Adapt tests.
19+
20+
## [2.0.0-beta.1] - 2021-01-14
21+
22+
### Added
23+
- Add mocks, routes, routes-variants and mock-custom-routes-variants apis
24+
25+
### Changed
26+
- Move behaviors and fixtures apis under legacy folder
27+
- refactor: Use helper to create routers with same structure
28+
29+
### Removed
30+
- Remove deprecated api paths
31+
- Remove adminApiDeprecatedPaths option.
32+
1833
## [1.5.0] - 2020-12-25
1934

2035
### Added

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +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 }`
3946
* `GET` `/admin/alerts` Returns current alerts.
40-
* `GET` `/admin/alerts/:id` Returns an specific alert. The alert `id` is equivalent to the alert `context`.
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)_.
4148

42-
> Deprecated api resources under "/mocks" api path are still available.
49+
> v1.x deprecated api resources are also still available under the `/legacy` path.
4350
4451
## Contributing
4552

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)