Skip to content

Commit

Permalink
npalmGH-240 add backwards compatibility test
Browse files Browse the repository at this point in the history
  • Loading branch information
larmitage-bjss committed Mar 5, 2024
1 parent bd71f41 commit dfa6c51
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
15 changes: 15 additions & 0 deletions __tests__/action-docs-action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,21 @@ describe("Test usage format", () => {
});
});

describe("Backwards compatibility", () => {
test("Deprecated action option still works correctly", async () => {
await testReadme(
{
actionFile: path.join(fixtureDir, "all_fields_action.yml"),
originalReadme: path.join(fixtureDir, "action_deprecated.input"),
fixtureReadme: path.join(fixtureDir, "action_deprecated.output"),
},
{
includeNameHeader: true,
},
);
});
});

interface ReadmeTestFixtures {
actionFile: string;
originalReadme: string;
Expand Down
11 changes: 11 additions & 0 deletions __tests__/fixtures/action/action_deprecated.input
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- action-docs-header action="__tests__/fixtures/action/all_fields_action.yml" -->

<!-- action-docs-description action="__tests__/fixtures/action/all_fields_action.yml" -->

<!-- action-docs-usage action="__tests__/fixtures/action/all_fields_action.yml" project="npalm/action-docs" version="v1" -->

<!-- action-docs-inputs action="__tests__/fixtures/action/all_fields_action.yml" -->

<!-- action-docs-outputs action="__tests__/fixtures/action/all_fields_action.yml" -->

<!-- action-docs-runs action="__tests__/fixtures/action/all_fields_action.yml" -->
74 changes: 74 additions & 0 deletions __tests__/fixtures/action/action_deprecated.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<!-- action-docs-header action="__tests__/fixtures/action/all_fields_action.yml" -->
## An Action
<!-- action-docs-header action="__tests__/fixtures/action/all_fields_action.yml" -->

<!-- action-docs-description action="__tests__/fixtures/action/all_fields_action.yml" -->
### Description

Default test
<!-- action-docs-description action="__tests__/fixtures/action/all_fields_action.yml" -->

<!-- action-docs-usage action="__tests__/fixtures/action/all_fields_action.yml" project="npalm/action-docs" version="v1" -->
### Usage

```yaml
- uses: npalm/action-docs@v1
with:
inputA:
# A description A
#
# Required: false
# Default: ""

inputB:
# A description B
#
# Required: true
# Default: ""

inputC:
# A description C
#
# Required: true
# Default: C

inputD:
# A description D
#
# Required: false
# Default: D

inputE:
# A description E
#
# Required: false
# Default: false
```
<!-- action-docs-usage action="__tests__/fixtures/action/all_fields_action.yml" project="npalm/action-docs" version="v1" -->

<!-- action-docs-inputs action="__tests__/fixtures/action/all_fields_action.yml" -->
### Inputs

| name | description | required | default |
| --- | --- | --- | --- |
| `inputA` | <p>A description A</p> | `false` | `""` |
| `inputB` | <p>A description B</p> | `true` | `""` |
| `inputC` | <p>A description C</p> | `true` | `C` |
| `inputD` | <p>A description D</p> | `false` | `D` |
| `inputE` | <p>A description E</p> | `false` | `false` |
<!-- action-docs-inputs action="__tests__/fixtures/action/all_fields_action.yml" -->

<!-- action-docs-outputs action="__tests__/fixtures/action/all_fields_action.yml" -->
### Outputs

| name | description |
| --- | --- |
| `outputA` | <p>A description A</p> |
| `outputB` | <p>A description B</p> |
<!-- action-docs-outputs action="__tests__/fixtures/action/all_fields_action.yml" -->

<!-- action-docs-runs action="__tests__/fixtures/action/all_fields_action.yml" -->
### Runs

This action is a `node12` action.
<!-- action-docs-runs action="__tests__/fixtures/action/all_fields_action.yml" -->

0 comments on commit dfa6c51

Please sign in to comment.