Skip to content

Commit 521ddc3

Browse files
committed
feat(api): added rest-client tests for VS Code
1 parent 15ef31d commit 521ddc3

File tree

4 files changed

+75
-6
lines changed

4 files changed

+75
-6
lines changed

.vscode/extensions.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
{
2-
"recommendations": [
3-
"nrwl.angular-console",
4-
"angular.ng-template",
5-
"ms-vscode.vscode-typescript-tslint-plugin",
6-
"esbenp.prettier-vscode"
7-
]
2+
"recommendations": [
3+
"nrwl.angular-console",
4+
"angular.ng-template",
5+
"ms-vscode.vscode-typescript-tslint-plugin",
6+
"esbenp.prettier-vscode",
7+
"googlecloudtools.cloudcode",
8+
"DavidAnson.vscode-markdownlint",
9+
"ms-azuretools.vscode-docker",
10+
"EditorConfig.EditorConfig",
11+
"donjayamanne.githistory",
12+
"eamodio.gitlens",
13+
"humao.rest-client"
14+
]
815
}

.vscode/settings.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"editor.fontFamily": "FiraCode-Retina",
3+
"editor.fontLigatures": true,
4+
5+
// REST CLIENT
6+
"rest-client.environmentVariables": {
7+
"$shared": {
8+
"client-id": "ngxapi",
9+
"username": "sumo3",
10+
"password": "demo"
11+
},
12+
"local": {
13+
"oidc-issuer-url": "https://keycloak.kashmora.com/auth/realms/ngx",
14+
"api-url": "http://localhost:3000"
15+
},
16+
"local-admin": {
17+
"oidc-issuer-url": "https://keycloak.kashmora.com/auth/realms/ngx",
18+
"api-url": "http://localhost:3000",
19+
"username": "ngxadmin",
20+
"password": "ngxadmin"
21+
},
22+
"production": {
23+
"oidc-issuer-url": "https://keycloak.kashmora.com/auth/realms/ngx",
24+
"api-url": "https://api.kashmora.com"
25+
}
26+
}
27+
}

apps/api/test-rest-api-vs-code.http

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
### Generate JWT access token
2+
# @name login
3+
POST {{oidc-issuer-url}}/protocol/openid-connect/token
4+
Content-Type: application/x-www-form-urlencoded
5+
6+
username={{username}}&password={{password}}&client_id={{client-id}}&grant_type=password&scope=openid
7+
8+
@authToken = {{login.response.body.access_token}}
9+
10+
### Test create notification
11+
# @name createNotification
12+
POST {{api-url}}/api/notifications
13+
content-type: application/json; charset=utf-8
14+
Authorization: Bearer {{authToken}}
15+
16+
{"title":"test123","body":"test12345","target":"sumo-topic","targetType":"topic","icon":"notifications","color":"warn","native":true}
17+
18+
### Test get notifications
19+
# @name getNotification
20+
GET {{api-url}}/api/notifications
21+
Accept: application/json
22+
Authorization: Bearer {{authToken}}
23+
24+
25+
### Test send notification
26+
# @name sendNotification
27+
POST {{api-url}}/api/notifications/send
28+
content-type: application/json; charset=utf-8
29+
Authorization: Bearer {{authToken}}
30+
31+
{ "id" : "6a06cb98-1a3f-43ac-84e1-2312097decf9", "target": "sumo-topic" }
32+
33+
###
34+
35+
File renamed without changes.

0 commit comments

Comments
 (0)