Skip to content

Commit 87b2045

Browse files
bc-devrevgithub-actions[bot]Atul-Butola
authored
editorial changes for snap-in testing (#139)
* edit * Update fern/docs/pages/testing.mdx Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update testing.mdx --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Atul-Butola <[email protected]>
1 parent 203d2ab commit 87b2045

File tree

1 file changed

+21
-34
lines changed

1 file changed

+21
-34
lines changed

fern/docs/pages/testing.mdx

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,69 @@
1-
To test out changes in snap-in locally, developers can create a snap-in version in test mode.
2-
A snap-in version created in test mode enables developers to specify a public HTTP URL to receive events from DevRev. This makes for
1+
To test out changes in snap-in locally, you can create a snap-in version in test mode.
2+
A snap-in version created in test mode enables you to specify a public HTTP URL to receive events from DevRev. This makes for
33
quick code changes on the local machine without needing to repeatedly deploy the snap-in again for testing the changes.
44

5-
To set up the framework, the developer needs to
5+
To set up the framework, follow these steps.
66

7-
- Run the server local server present in the template on the mentioned port.
8-
- Expose this port to a public URL.
9-
- Create a snap-in version in test mode mentioning this URL.
10-
11-
### Setting up the server
12-
13-
To test out a snap-in version locally, follow the below steps:
7+
<Steps>
8+
### Set up the server
149

1510
1. Run a server locally to ingest events from DevRev. The `port` parameter is optional. If not set, the server starts default on `8000`.
1611

1712
```
1813
npm run test:server -- --port=<PORT>
1914
```
2015

21-
2. Expose the local port as a publicly available URL. We recommend using [`ngrok`](https://ngrok.com/download) since it is free and easy to set up. The command for running ngrok tunnelling on port `8000`:
16+
2. Expose the local port as a publicly available URL. We recommend using [`ngrok`](https://ngrok.com/download) since it is free and easy to set up. The command for running ngrok tunneling on port `8000`:
2217

2318
```
2419
ngrok http 8000
2520
```
2621

27-
This returns a public HTTP URL.
22+
This returns a public HTTP URL.
2823

29-
3. Create a snap-in version with the `testing-url` flag set
24+
3. Create a snap-in version with the `testing-url` flag set.
3025

3126
```
3227
devrev snap_in_version create-one --manifest <manifest path> --create-package --testing-url <HTTP_URL>
3328
```
3429

35-
Here, `HTTP_URL` is the publicly available URL from Step 2. The URL should start with `http` or `https`. Do note that
36-
the developer cannot use the `path` and `testing-url` flags together.
30+
`HTTP_URL` is the publicly available URL from the previous step. The URL should start with `http` or `https`. Do note that
31+
the developer cannot use the `path` and `testing-url` flags together.
3732

3833
4. Once the snap-in version is ready, create a snap-in, update, and activate it.
3934

4035
```
4136
devrev snap_in draft
42-
```
43-
44-
Update the snap-in through UI or using the CLI:
45-
46-
```
4737
devrev snap_in update
48-
```
49-
50-
Activate the snap-in through UI or the CLI command:
51-
52-
```
5338
devrev snap_in activate
5439
```
5540

56-
### Receiving events locally
41+
### Receive events locally
5742

5843
After the snap-in has been activated, it can receive events locally from DevRev as a
59-
snap-in would. If the snap-in is listening to `work_created` event type, then creating a
60-
new work-item would send the event to the local server.
44+
snap-in would. For example, if the snap-in is listening for the `work_created` event type, then creating a
45+
new work item would send the event to the local server.
6146

62-
If utilizing ngrok, accessing the ngrok UI is possible by opening http://127.0.0.1:4040/ in the browser. This interface offers a neat way to review the list of requests and replay them if necessary.
47+
If utilizing ngrok, you can access the ngrok UI by opening http://127.0.0.1:4040/ in the browser. This interface offers a neat way to review the list of requests and replay them if necessary.
6348

64-
The service account token included with the request is valid for only 30 minutes. Therefore, attempting to call the DevRev API with that token for events older than this timeframe will result in a '401 Unauthorized' error.
49+
The service account token included with the request is valid for only 30 minutes. Therefore, attempting to call the DevRev API with that token for events older than this timeframe results in a _401 Unauthorized_ error.
6550

66-
### Updating manifest or the URL
51+
### Update the URL
6752

6853
The code can be changed without the need to create a snap-in version or redeploy the snap-in. On any change to the
69-
`src` folder, the server restarts with the updated changes. However, on [patch compatible](/snapin-development/upgrade-snap-ins#version-compatibility) updates to the manifest or the testing URL, we can `upgrade` the snap-in version.
54+
`src` folder, the server restarts with the updated changes. However, on [patch compatible](/snapin-development/upgrade-snap-ins#version-compatibility) updates to the manifest or the testing URL, you can `upgrade` the snap-in version.
7055

7156
```
7257
devrev snap_in_version upgrade --manifest <PATH_TO_MANIFEST> --testing-url <UPDATED_URL>
7358
```
7459

75-
In case of non-patch compatible updates, the `force` flag can be used to upgrade the version. However, this will delete any
60+
In case of non-patch compatible updates, the `force` flag can be used to upgrade the version. However, forcing the update deletes any
7661
existing snap-ins that have been created from this version.
7762

7863
```
7964
devrev snap_in_version upgrade --force --manifest <PATH_TO_MANIFEST> --testing-url <UPDATED_URL>
8065
```
8166

82-
Do note that manifest must always be provided when upgrading a snap-in version.
67+
The manifest must always be provided when upgrading a snap-in version.
68+
69+
</Steps>

0 commit comments

Comments
 (0)