Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/build-for-developers/cli-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ So you want to write unit tests against your job code? See
the full guide.

Unit tests only work against pure functions in your code (top level function
declarations): they do not qork against operations or adaptor functions because
declarations): they do not work against operations or adaptor functions because
they require connected backend services.

To unit test functions in your job code:
Expand All @@ -253,16 +253,16 @@ openfn compile --exports-only

Compiled files are written to `dist/` as `.mjs` files.

With `--exports-only` Operations are stripped out entirely, leaving only
exported functions and variables .
With `--exports-only`, operations are stripped out entirely, leaving only
exported functions and variables.

**Compile a single workflow by name:**

```bash
openfn compile my-workflow --exports-only
```

**Recompile whenever a job code changes:**
**Recompile whenever job code changes:**

```bash
openfn compile --exports-only --watch
Expand Down
4 changes: 2 additions & 2 deletions docs/jobs/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@ fn(state => ({
}));
```

To test the export helpers
[See Unit testing jobs](/documentation/jobs/unit-testing-jobs)
To test the exported helpers, see
[Unit testing jobs](/documentation/jobs/unit-testing-jobs).
10 changes: 5 additions & 5 deletions docs/jobs/unit-testing-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Most job code goes like this: fetch some records, reshape them, send them
somewhere else. But the reshaping bit often grows into complex logic - parsing a
string into a structured record, mapping local codes onto DHIS2 data elements,
normalising a dozen date formats into one.
normalizing a dozen date formats into one.

Unit testing that logic helps to validate that the code runs correctly, and
helps to prevent errors occurring when the code is modified later.
Expand Down Expand Up @@ -114,11 +114,11 @@ avoids the warning without touching your `package.json`.

:::

<!-- prettier ignore -->
<!-- prettier-ignore -->
<Tabs groupId="write-a-test">
<TabItem value="source" label="The job code">
```js title="workflows/sms-parser/parse-message.js"
export const FIELDS = ['id','name', 'dob', 'weight'];
```js title="workflows/sms-parser/parse-message.js"
export const FIELDS = ['id', 'name', 'dob', 'weight'];

export const parseSms = text => {
const parts = text.trim().split('#');
Expand All @@ -135,7 +135,7 @@ avoids the warning without touching your `package.json`.
```
</TabItem>
<TabItem value="output" label="The compiled output">

After `openfn compile --exports-only`:

```js title="dist/sms-parser/parse-message.mjs"
Expand Down
Loading