Skip to content

Commit a2b4902

Browse files
authored
Fix documentation snippet tests (#49)
## What does this PR do ? This PR fixes documentation snippet test. They failed due to the new eslint [sort-keys](https://eslint.org/docs/rules/sort-keys) rule applied to Kuzzle
1 parent 0a99844 commit a2b4902

File tree

11 files changed

+22
-21
lines changed

11 files changed

+22
-21
lines changed

doc/2/controllers/auth/check-token/snippets/check-token.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ hooks:
44
before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}'
55
after: curl -X DELETE kuzzle:7512/users/foo
66
template: default
7-
expected: ^{"valid":(true|false),"expiresAt":[0-9]+}$
7+
expected: ^{"expiresAt":[0-9]+,"valid":(true|false)}$
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: Auth#FetMyRightsAsync
1+
name: Auth#GetMyRightsAsync
22
description: Returns the rights for the user linked to the `JSON Web Token`.
33
hooks:
44
before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}'
55
after: curl -X DELETE kuzzle:7512/users/foo
66
template: default
7-
expected: ^\[({"controller":".*","action":".*","collection":".*","index":".*","value":".*"}(,)*)+\]$
7+
expected: ^\[({"action":".*","collection":".*","controller":".*","index":".*","value":".*"}(,)*)+\]$

doc/2/controllers/auth/login/snippets/login.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ hooks:
55
before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}'
66
after: curl -X DELETE kuzzle:7512/users/foo
77
template: default
8-
expected: ^{"_id":".*","jwt":".*","expiresAt":[0-9]+,"ttl":[0-9]+}$
8+
expected: ^{"_id":".*","expiresAt":[0-9]+,"jwt":".*","ttl":[0-9]+}$

doc/2/controllers/auth/refresh-token/snippets/refresh-token.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ hooks:
44
before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}'
55
after: curl -X DELETE kuzzle:7512/users/foo
66
template: default
7-
expected: ^{"_id":".*","jwt":".*","expiresAt":[0-9]+,"ttl":[0-9]+}$
7+
expected: ^{"_id":".*","expiresAt":[0-9]+,"jwt":".*","ttl":[0-9]+}$

doc/2/controllers/bulk/import-async/snippets/import-async.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ hooks:
66
curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi
77
after: curl -X DELETE kuzzle:7512/nyc-open-data
88
template: default
9-
expected: 'successes":\[.*\],"errors":\[\]'
9+
expected: 'errors":\[\],"successes":\[.*\]'

doc/2/controllers/bulk/mwrite-async/snippets/mwrite-async.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ hooks:
66
curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi
77
after: curl -X DELETE kuzzle:7512/nyc-open-data
88
template: default
9-
expected: 'successes":\[.*\],"errors":\[\]'
9+
expected: 'errors":\[\],"successes":\[.*\]'

doc/2/controllers/bulk/write-async/snippets/write-async.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ hooks:
66
curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi
77
after: curl -X DELETE kuzzle:7512/nyc-open-data
88
template: default
9-
expected: ^{"_id":".+","_version":[0-9]+,"_source":{"_kuzzle_info":{.*}}}$
9+
expected: ^{"_id":".+","_source":{"_kuzzle_info":{.*}},"_version":[0-9]+}$

doc/2/controllers/document/m-delete/index.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,26 @@ public async Task<JObject> MDeleteAsync(
2222

2323
<br/>
2424

25-
| Argument | Type | Description |
26-
| ------------ | ----------------------------------------- | ------------------------------ |
27-
| `index` | <pre>string</pre> | Index name |
28-
| `collection` | <pre>string</pre> | Collection name |
29-
| `ids` | <pre>string[]</pre> | IDs of the documents to delete |
30-
| `waitForRefresh` | <pre>bool</pre><br/>(`false`) | If `true`, waits for the change to be reflected for `search` (up to 1s) |
25+
| Argument | Type | Description |
26+
| ------------------ | ----------------------------------------- | ------------------------------ |
27+
| `index` | <pre>string</pre> | Index name |
28+
| `collection` | <pre>string</pre> | Collection name |
29+
| `ids` | <pre>string[]</pre> | IDs of the documents to delete |
30+
| `waitForRefresh` | <pre>bool</pre><br/>(`false`) | If `true`, waits for the change to be reflected for `search` (up to 1s) |
3131

3232
## Return
3333

3434
Returns a JObject containing 2 arrays: `successes` and `errors`
3535

36-
The `successes` array contain the successfuly deleted document IDs.
36+
The `successes` array contains the successfully deleted document IDs.
3737

3838
Each deletion error is an object of the `errors` array with the following properties:
3939

40-
| Name | Type | Description |
41-
| --------- | ----------------- | ------------------------------------------------------ |
42-
| `id` | <pre>String</pre> | Document ID |
40+
| Name | Type | Description |
41+
| --------- | ----------------- | --------------------- |
42+
| `id` | <pre>String</pre> | Document ID |
4343
| `reason` | <pre>String</pre> | Human readable reason |
44+
| `status` | <pre>int</pre> | HTTP status code |
4445

4546
## Exceptions
4647

doc/2/controllers/server/get-all-stats/snippets/getAllStats.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ hooks:
44
before:
55
after:
66
template: default
7-
expected: ^(All Kuzzle Stats:) {"hits":\[({"connections":{.*},"ongoingRequests":{.*},"completedRequests":{.*},"failedRequests":{.*},"timestamp":[0-9]{13}}(,)*)+\],"total":[0-9]+}$
7+
expected: ^(All Kuzzle Stats:) {"hits":\[({"completedRequests":{.*},"connections":{.*},"failedRequests":{.*},"ongoingRequests":{.*},"timestamp":[0-9]{13}}(,)*)+\],"total":[0-9]+}$

doc/2/controllers/server/get-last-stats/snippets/getLastStats.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ hooks:
44
before:
55
after:
66
template: default
7-
expected: ^(Last Kuzzle stats:) {("connections":{.*}),("ongoingRequests":{.*}),("completedRequests":{.*}),("failedRequests":{.*}),("timestamp":[0-9]{13})}$
7+
expected: ^(Last Kuzzle stats:) {("timestamp":[0-9]{13}),("completedRequests":{.*}),("connections":{.*}),("failedRequests":{.*}),("ongoingRequests":{.*})}$

doc/2/controllers/server/get-stats/snippets/getStats.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ hooks:
44
before:
55
after:
66
template: default
7-
expected: ^(Kuzzle stats:) {"hits":\[({"connections":{.*},"ongoingRequests":{.*},"completedRequests":{.*}},"failedRequests":{.*},"timestamp":[0-9]{13}}(,)*)*\],"total":[0-9]+}$
7+
expected: ^(Kuzzle stats:) {"hits":\[({"completedRequests":{.*}},"connections":{.*},"failedRequests":{.*},"ongoingRequests":{.*},"timestamp":[0-9]{13}}(,)*)*\],"total":[0-9]+}$

0 commit comments

Comments
 (0)