Compare commits

...

13 commits

Author SHA1 Message Date
Ethan Lane 55c11761be Fix tests
All checks were successful
continuous-integration/drone/push Build is passing
2024-01-17 18:18:15 +00:00
Ethan Lane abd483fb98 Merge branch 'develop' into feature/73-cli-json 2024-01-17 18:15:27 +00:00
RenovateBot 8c440c0539 Update dependency np to v9 (#135)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [np](https://github.com/sindresorhus/np) | devDependencies | major | [`^8.0.0` -> `^9.0.0`](https://renovatebot.com/diffs/npm/np/8.0.4/9.2.0) |

---

### Release Notes

<details>
<summary>sindresorhus/np (np)</summary>

### [`v9.2.0`](https://github.com/sindresorhus/np/releases/tag/v9.2.0)

[Compare Source](https://github.com/sindresorhus/np/compare/v9.1.0...v9.2.0)

-   Fix yarn npm publish for scoped packages  [`8d3a984`](https://github.com/sindresorhus/np/commit/8d3a984)
-   Fix broken revert code after publish failure  [`819ed29`](https://github.com/sindresorhus/np/commit/819ed29)

### [`v9.1.0`](https://github.com/sindresorhus/np/releases/tag/v9.1.0)

[Compare Source](https://github.com/sindresorhus/np/compare/v9.0.0...v9.1.0)

-   Add Yarn Berry support ([#&#8203;723](https://github.com/sindresorhus/np/issues/723))  [`0d9522b`](https://github.com/sindresorhus/np/commit/0d9522b)

### [`v9.0.0`](https://github.com/sindresorhus/np/releases/tag/v9.0.0)

[Compare Source](https://github.com/sindresorhus/np/compare/v8.0.4...v9.0.0)

##### Breaking

-   Require Node.js 18 and npm 9  [`6c2e00e`](https://github.com/sindresorhus/np/commit/6c2e00e)

##### Improvements

-   Group unpublished files in folders ([#&#8203;716](https://github.com/sindresorhus/np/issues/716))  [`c31c2bc`](https://github.com/sindresorhus/np/commit/c31c2bc)
-   improve messages related to new files and dependencies ([#&#8203;702](https://github.com/sindresorhus/np/issues/702))  [`ad7b09e`](https://github.com/sindresorhus/np/commit/ad7b09e)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/135
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-16 19:15:10 +00:00
RenovateBot a9a756a001 Update dependency got to v14 (#134)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [got](https://github.com/sindresorhus/got) | resolutions | major | [`^13.0.0` -> `^14.0.0`](https://renovatebot.com/diffs/npm/got/13.0.0/14.0.0) |

---

### Release Notes

<details>
<summary>sindresorhus/got (got)</summary>

### [`v14.0.0`](https://github.com/sindresorhus/got/releases/tag/v14.0.0)

[Compare Source](https://github.com/sindresorhus/got/compare/v13.0.0...v14.0.0)

##### Breaking

-   Require Node.js 20 ([#&#8203;2313](https://github.com/sindresorhus/got/issues/2313))  [`a004263`](https://github.com/sindresorhus/got/commit/a004263)
    -   Why not target the oldest active Node.js LTS, which is Node.js 18? I usually strictly follow this convention in my packages. However, this package is the exception because the HTTP part of Node.js is consistently buggy, and I don't have time to work around issues in older Node.js releases. I you need to still support Node.js 18, I suggest staying on Got v13, which is quite stable. Node.js 18 will be out of active LTS in 5 months.

##### Improvements

-   Make `followRedirect` option accept a function ([#&#8203;2306](https://github.com/sindresorhus/got/issues/2306))  [`7c3f147`](https://github.com/sindresorhus/got/commit/7c3f147)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/134
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-16 19:14:22 +00:00
RenovateBot cbf1dea9c6 Update dependency typescript to v5.3.3 (#133)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [typescript](https://www.typescriptlang.org/) ([source](https://github.com/Microsoft/TypeScript)) | devDependencies | minor | [`5.2.2` -> `5.3.3`](https://renovatebot.com/diffs/npm/typescript/5.2.2/5.3.3) |

---

### Release Notes

<details>
<summary>Microsoft/TypeScript (typescript)</summary>

### [`v5.3.3`](https://github.com/microsoft/TypeScript/releases/tag/v5.3.3): TypeScript 5.3.3

[Compare Source](https://github.com/Microsoft/TypeScript/compare/v5.3.2...v5.3.3)

For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/).

For the complete list of fixed issues, check out the

-   [fixed issues query for Typescript 5.3.0 (Beta)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.0%22+is%3Aclosed+).
-   [fixed issues query for Typescript 5.3.1 (RC)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.1%22+is%3Aclosed+).
-   [fixed issues query for Typescript 5.3.2 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.2%22+is%3Aclosed+).
-   [fixed issues query for Typescript 5.3.3 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.3%22+is%3Aclosed+).

Downloads are available on:

-   [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild)

### [`v5.3.2`](https://github.com/microsoft/TypeScript/releases/tag/v5.3.2): TypeScript 5.3

[Compare Source](https://github.com/Microsoft/TypeScript/compare/v5.2.2...v5.3.2)

For release notes, check out the [release announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/).

For the complete list of fixed issues, check out the

-   [fixed issues query for Typescript 5.3.0 (Beta)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.0%22+is%3Aclosed+).
-   [fixed issues query for Typescript 5.3.1 (RC)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.1%22+is%3Aclosed+).
-   [fixed issues query for Typescript 5.3.2 (Stable)](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93\&q=milestone%3A%22TypeScript+5.3.2%22+is%3Aclosed+).

Downloads are available on:

-   [NuGet package](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/133
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-16 19:13:22 +00:00
RenovateBot 43687410c0 Update dependency eslint to v8.56.0 (#132)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [eslint](https://eslint.org) ([source](https://github.com/eslint/eslint)) | devDependencies | minor | [`8.55.0` -> `8.56.0`](https://renovatebot.com/diffs/npm/eslint/8.55.0/8.56.0) |
| [@types/eslint](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | minor | [`8.44.8` -> `8.56.2`](https://renovatebot.com/diffs/npm/@types%2feslint/8.44.8/8.56.2) |

---

### Release Notes

<details>
<summary>eslint/eslint (eslint)</summary>

### [`v8.56.0`](https://github.com/eslint/eslint/releases/tag/v8.56.0)

[Compare Source](https://github.com/eslint/eslint/compare/v8.55.0...v8.56.0)

#### Features

-   [`0dd9704`](0dd9704c47) feat: Support custom severity when reporting unused disable directives ([#&#8203;17212](https://github.com/eslint/eslint/issues/17212)) (Bryan Mishkin)
-   [`31a7e3f`](31a7e3fde4) feat: fix no-restricted-properties false negatives with unknown objects ([#&#8203;17818](https://github.com/eslint/eslint/issues/17818)) (Arka Pratim Chaudhuri)

#### Bug Fixes

-   [`7d5e5f6`](7d5e5f6884) fix: `TypeError: fs.exists is not a function` on read-only file system ([#&#8203;17846](https://github.com/eslint/eslint/issues/17846)) (Francesco Trotta)
-   [`74739c8`](74739c849b) fix: suggestion with invalid syntax in no-promise-executor-return rule ([#&#8203;17812](https://github.com/eslint/eslint/issues/17812)) (Bryan Mishkin)

#### Documentation

-   [`9007719`](90077199fe) docs: update link in ways-to-extend.md ([#&#8203;17839](https://github.com/eslint/eslint/issues/17839)) (Amel SELMANE)
-   [`3a22236`](3a22236f8d) docs: Update README (GitHub Actions Bot)
-   [`54c3ca6`](54c3ca6f2d) docs: fix migration-guide example ([#&#8203;17829](https://github.com/eslint/eslint/issues/17829)) (Tanuj Kanti)
-   [`4391b71`](4391b71e62) docs: check config comments in rule examples ([#&#8203;17815](https://github.com/eslint/eslint/issues/17815)) (Francesco Trotta)
-   [`fd28363`](fd2836342c) docs: remove mention about ESLint stylistic rules in readme ([#&#8203;17810](https://github.com/eslint/eslint/issues/17810)) (Zwyx)
-   [`48ed5a6`](48ed5a6dad) docs: Update README (GitHub Actions Bot)

#### Chores

-   [`ba6af85`](ba6af85c7d) chore: upgrade [@&#8203;eslint/js](https://github.com/eslint/js)[@&#8203;8](https://github.com/8).56.0 ([#&#8203;17864](https://github.com/eslint/eslint/issues/17864)) (Milos Djermanovic)
-   [`60a531a`](60a531a9c0) chore: package.json update for [@&#8203;eslint/js](https://github.com/eslint/js) release (Jenkins)
-   [`ba87a06`](ba87a0651a) chore: update dependency markdownlint to ^0.32.0 ([#&#8203;17783](https://github.com/eslint/eslint/issues/17783)) (renovate\[bot])
-   [`9271d10`](9271d10d9e) chore: add GitHub issue template for docs issues ([#&#8203;17845](https://github.com/eslint/eslint/issues/17845)) (Josh Goldberg )
-   [`70a686b`](70a686b3c1) chore: Convert rule tests to FlatRuleTester ([#&#8203;17819](https://github.com/eslint/eslint/issues/17819)) (Nicholas C. Zakas)
-   [`f3a599d`](f3a599d34c) chore: upgrade eslint-plugin-unicorn to v49.0.0 ([#&#8203;17837](https://github.com/eslint/eslint/issues/17837)) (唯然)
-   [`905d4b7`](905d4b75ab) chore: upgrade eslint-plugin-eslint-plugin v5.2.1 ([#&#8203;17838](https://github.com/eslint/eslint/issues/17838)) (唯然)
-   [`4d7c3ce`](4d7c3ce246) chore: update eslint-plugin-n v16.4.0 ([#&#8203;17836](https://github.com/eslint/eslint/issues/17836)) (唯然)
-   [`fd0c60c`](fd0c60c3be) ci: unpin Node.js 21.2.0 ([#&#8203;17821](https://github.com/eslint/eslint/issues/17821)) (Francesco Trotta)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/132
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-16 19:12:27 +00:00
RenovateBot bb3072e8f6 Update dependency @typescript-eslint/eslint-plugin to v6.18.1 (#130)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) | devDependencies | minor | [`6.13.1` -> `6.18.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/6.13.1/6.18.1) |

---

### Release Notes

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v6.18.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6181-2024-01-08)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.18.0...v6.18.1)

##### 🩹 Fixes

-   **eslint-plugin:** \[no-non-null-assertion] provide valid fix when member access is on next line

-   **eslint-plugin:** \[no-unnecessary-condition] improve checking optional callee

-   **eslint-plugin:** \[prefer-readonly] support modifiers of unions and intersections

-   **eslint-plugin:** \[switch-exhaustiveness-check] fix new allowDefaultCaseForExhaustiveSwitch option

##### ❤️  Thank You

-   auvred
-   James
-   Josh Goldberg 
-   YeonJuan

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.18.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6180-2024-01-06)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.17.0...v6.18.0)

##### 🚀 Features

-   **typescript-estree:** throw on invalid update expressions

-   **eslint-plugin:** \[no-var-requires, no-require-imports] allow option

##### ❤️  Thank You

-   auvred
-   Joshua Chen

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.17.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6170-2024-01-01)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0)

##### Bug Fixes

-   **eslint-plugin:** \[no-restricted-imports] prevent crash when `patterns` or `paths` in options are empty ([#&#8203;8108](https://github.com/typescript-eslint/typescript-eslint/issues/8108)) ([675e987](675e987ca1))

##### Features

-   **eslint-plugin:** \[no-floating-promises] flag result of .map(async) ([#&#8203;7897](https://github.com/typescript-eslint/typescript-eslint/issues/7897)) ([5857356](5857356962))
-   **eslint-plugin:** \[switch-exhaustiveness-check] add an option to warn against a `default` case on an already exhaustive `switch` ([#&#8203;7539](https://github.com/typescript-eslint/typescript-eslint/issues/7539)) ([6a219bd](6a219bdfe6))

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.16.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6160-2023-12-25)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.15.0...v6.16.0)

##### Bug Fixes

-   **eslint-plugin:** \[unbound-method] exempt all non-Promise built-in statics ([#&#8203;8096](https://github.com/typescript-eslint/typescript-eslint/issues/8096)) ([3182959](31829591e2))

##### Features

-   **eslint-plugin:** deprecate formatting (meta.type: layout) rules ([#&#8203;8073](https://github.com/typescript-eslint/typescript-eslint/issues/8073)) ([04dea84](04dea84e8e))
-   **eslint-plugin:** deprecate no-extra-semi in favor of ESLint Stylistic equivalent ([#&#8203;8123](https://github.com/typescript-eslint/typescript-eslint/issues/8123)) ([9368bf3](9368bf390a))

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.15.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6150-2023-12-18)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.14.0...v6.15.0)

##### Features

-   **eslint-plugin:** \[no-useless-template-literals] add new rule ([#&#8203;7957](https://github.com/typescript-eslint/typescript-eslint/issues/7957)) ([ff75785](ff75785f4c)), closes [#&#8203;2846](https://github.com/typescript-eslint/typescript-eslint/issues/2846)
-   require-array-sort-compare + toSorted ([#&#8203;8052](https://github.com/typescript-eslint/typescript-eslint/issues/8052)) ([c9661c8](c9661c8bbf))

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.14.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6140-2023-12-11)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.13.2...v6.14.0)

##### Bug Fixes

-   **eslint-plugin:** add no-unsafe-unary-minus, prefer-destructuring to disable-type-checked ([#&#8203;8038](https://github.com/typescript-eslint/typescript-eslint/issues/8038)) ([431cd15](431cd1559f))
-   **eslint-plugin:** correct message for `no-unsafe-unary-minus` ([#&#8203;7998](https://github.com/typescript-eslint/typescript-eslint/issues/7998)) ([705370a](705370ac0d))

##### Features

-   **eslint-plugin:** \[explicit-function-return-type] add support for typed class property definitions ([#&#8203;8027](https://github.com/typescript-eslint/typescript-eslint/issues/8027)) ([bff47d7](bff47d7885))
-   **eslint-plugin:** \[require-await] allow yielding Promise in async generators ([#&#8203;8003](https://github.com/typescript-eslint/typescript-eslint/issues/8003)) ([4c3e704](4c3e704b97))

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

#### [6.13.2](https://github.com/typescript-eslint/typescript-eslint/compare/v6.13.1...v6.13.2) (2023-12-04)

**Note:** Version bump only for package [@&#8203;typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin)

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

#### [6.13.1](https://github.com/typescript-eslint/typescript-eslint/compare/v6.13.0...v6.13.1) (2023-11-28)

**Note:** Version bump only for package [@&#8203;typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin)

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

### [`v6.13.2`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#6132-2023-12-04)

[Compare Source](https://github.com/typescript-eslint/typescript-eslint/compare/v6.13.1...v6.13.2)

**Note:** Version bump only for package [@&#8203;typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/eslint-plugin)

You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/130
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-16 19:11:33 +00:00
RenovateBot 05b15cde08 Update dependency @babel/traverse to v7.23.7 (#129)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@babel/traverse](https://babel.dev/docs/en/next/babel-traverse) ([source](https://github.com/babel/babel)) | resolutions | patch | [`7.23.5` -> `7.23.7`](https://renovatebot.com/diffs/npm/@babel%2ftraverse/7.23.5/7.23.7) |

---

### Release Notes

<details>
<summary>babel/babel (@&#8203;babel/traverse)</summary>

### [`v7.23.7`](https://github.com/babel/babel/blob/HEAD/CHANGELOG.md#v7237-2023-12-29)

[Compare Source](https://github.com/babel/babel/compare/v7.23.6...v7.23.7)

##### 🐛 Bug Fix

-   `babel-traverse`
    -   [#&#8203;16191](https://github.com/babel/babel/pull/16191) fix: Crash when removing without `Program` ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helpers`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16180](https://github.com/babel/babel/pull/16180) fix: Class decorator `ctx.kind` is wrong ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-plugin-proposal-decorators`
    -   [#&#8203;16170](https://github.com/babel/babel/pull/16170) Fix decorator initProto usage in derived classes ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-core`
    -   [#&#8203;16167](https://github.com/babel/babel/pull/16167) Avoid unpreventable `unhandledRejection` events ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 🏠 Internal

-   `babel-helper-create-class-features-plugin`
    -   [#&#8203;16186](https://github.com/babel/babel/pull/16186) chore: Update deps ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16177](https://github.com/babel/babel/pull/16177) Merge decorators into class features ([@&#8203;JLHwung](https://github.com/JLHwung))

### [`v7.23.6`](https://github.com/babel/babel/blob/HEAD/CHANGELOG.md#v7236-2023-12-11)

[Compare Source](https://github.com/babel/babel/compare/v7.23.5...v7.23.6)

##### 👓 Spec Compliance

-   `babel-generator`, `babel-parser`, `babel-types`
    -   [#&#8203;16154](https://github.com/babel/babel/pull/16154) Remove `TSPropertySignature.initializer` ([@&#8203;fisker](https://github.com/fisker))
-   `babel-helpers`, `babel-plugin-proposal-decorators`, `babel-plugin-transform-class-properties`, `babel-plugin-transform-class-static-block`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-runtime-corejs2`, `babel-runtime-corejs3`, `babel-runtime`, `babel-types`
    -   [#&#8203;16139](https://github.com/babel/babel/pull/16139) Apply `toPropertyKey` on decorator context name ([@&#8203;JLHwung](https://github.com/JLHwung))

##### 🐛 Bug Fix

-   `babel-generator`
    -   [#&#8203;16166](https://github.com/babel/babel/pull/16166) fix: Correctly indenting when `retainLines` is enabled ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helpers`, `babel-plugin-proposal-explicit-resource-management`
    -   [#&#8203;16150](https://github.com/babel/babel/pull/16150) `using`: Allow looking up `Symbol.dispose` on a function ([@&#8203;odinho](https://github.com/odinho))
-   `babel-plugin-proposal-decorators`, `babel-plugin-transform-class-properties`
    -   [#&#8203;16161](https://github.com/babel/babel/pull/16161) Ensure the `[[@&#8203;@&#8203;toPrimitive]]` call of a decorated class member key is invoked once ([@&#8203;JLHwung](https://github.com/JLHwung))
    -   [#&#8203;16148](https://github.com/babel/babel/pull/16148) Support named evaluation for decorated anonymous class exp ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-plugin-transform-for-of`, `babel-preset-env`
    -   [#&#8203;16011](https://github.com/babel/babel/pull/16011) fix: `for of` with `iterableIsArray` and shadowing variable  ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))
-   `babel-helpers`, `babel-plugin-proposal-decorators`, `babel-runtime-corejs2`, `babel-runtime-corejs3`, `babel-runtime`
    -   [#&#8203;16144](https://github.com/babel/babel/pull/16144) Set function name for decorated private non-field elements ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-plugin-transform-typescript`
    -   [#&#8203;16137](https://github.com/babel/babel/pull/16137) Fix references to enum values with merging ([@&#8203;nicolo-ribaudo](https://github.com/nicolo-ribaudo))

##### 🔬 Output optimization

-   `babel-helper-create-class-features-plugin`, `babel-plugin-transform-class-properties`
    -   [#&#8203;16159](https://github.com/babel/babel/pull/16159) Reuse computed key memoiser ([@&#8203;JLHwung](https://github.com/JLHwung))
-   `babel-helpers`, `babel-plugin-proposal-decorators`
    -   [#&#8203;16160](https://github.com/babel/babel/pull/16160) Optimize decorator helper size ([@&#8203;liuxingbaoyu](https://github.com/liuxingbaoyu))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/129
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-16 19:10:28 +00:00
RenovateBot 068ba8a86c Update dependency @types/jest to v29.5.11 (#126)
All checks were successful
continuous-integration/drone/push Build is passing
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped)) | devDependencies | patch | [`29.5.10` -> `29.5.11`](https://renovatebot.com/diffs/npm/@types%2fjest/29.5.10/29.5.11) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/126
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
2024-01-16 19:09:17 +00:00
Ethan Lane 5ea8b72e54 Add higher limit on json (#139)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Add higher limit on the json result
    - This will fix the tests not always fetching an image from r/rabbits, as not every post in the top is a single image

#125

## Type of change

Please delete options that are not relevant.

- [x] Bug fix (non-breaking change which fixes an issue)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/139
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-01-12 17:48:37 +00:00
Ethan Lane bc4f024619 Fix tests (#136)
Some checks failed
continuous-integration/drone/push Build is failing
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

#125

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

# Checklist

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/136
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2024-01-09 19:00:52 +00:00
Ethan Lane beba61e4e2 Add sort option (#123)
Some checks failed
continuous-integration/drone/push Build is failing
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Add sort option (`--sort`) to allow you to configure the sort by field
- Add query metadata option (`--query-metadata`, `-q`) to return the queried inputs
    - This helps with testing to ensure that the inputs are properly accepted

#74

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)
- [x] This change requires a documentation update

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

- Have tested manually and have added unit tests too
- I have added an option to include the query metadata to help with seeing if it worked

# Checklist

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that provde my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/123
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2023-12-08 17:10:00 +00:00
Ethan Lane a09beba4e4 Fix not being able to execute the code via ts-node (#122)
All checks were successful
continuous-integration/drone/push Build is passing
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

- Removed ts-node
    - Since we can execute the code via unit tests and the command line now, it doesn't make to have this anymore as we can test using a proper CLI
    - This also fixes the issue we have with ts-node, with it not working on the latest node version

#75, #119

## Type of change

Please delete options that are not relevant.

- [x] Bug fix (non-breaking change which fixes an issue)

# How Has This Been Tested?

Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration.

- This has been tested by running `yarn start`, and it now runs the cli interface

# Checklist

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that provde my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/122
Reviewed-by: VylpesTester <tester@vylpes.com>
Co-authored-by: Ethan Lane <ethan@vylpes.com>
Co-committed-by: Ethan Lane <ethan@vylpes.com>
2023-12-08 17:07:51 +00:00
10 changed files with 568 additions and 435 deletions

9
app.ts
View file

@ -1,9 +0,0 @@
import randomBunny from "./dist/index.js";
async function app() {
const result = await randomBunny('rabbits', 'hot');
console.log(result);
}
app();

View file

@ -23,8 +23,7 @@
}, },
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"start": "ts-node app.ts", "start": "node dist/cli.js",
"cli": "ts-node src/cli.ts",
"test": "jest", "test": "jest",
"lint": "eslint .", "lint": "eslint .",
"release": "np --no-publish" "release": "np --no-publish"
@ -37,21 +36,20 @@
"funding": "https://ko-fi.com/vylpes", "funding": "https://ko-fi.com/vylpes",
"devDependencies": { "devDependencies": {
"@types/eslint": "^8.21.1", "@types/eslint": "^8.21.1",
"@types/jest": "^29.5.8",
"@types/node": "^20.0.0", "@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/eslint-plugin": "^6.0.0",
"@types/jest": "^29.5.8",
"@typescript-eslint/parser": "^5.54.0", "@typescript-eslint/parser": "^5.54.0",
"eslint": "^8.49.0", "eslint": "^8.49.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-mock-extended": "^3.0.3", "jest-mock-extended": "^3.0.3",
"np": "^8.0.0", "np": "^9.0.0",
"ts-jest": "^29.1.1", "ts-jest": "^29.1.1",
"ts-mockito": "^2.6.1", "ts-mockito": "^2.6.1",
"ts-node": "^10.9.1",
"typescript": "^5.0.0" "typescript": "^5.0.0"
}, },
"resolutions": { "resolutions": {
"np/**/got": "^13.0.0", "np/**/got": "^14.0.0",
"**/semver": "^7.5.2", "**/semver": "^7.5.2",
"@babel/traverse": "^7.23.2" "@babel/traverse": "^7.23.2"
}, },

View file

@ -1,4 +1,4 @@
import { Command } from "commander"; import { Command, Option } from "commander";
import randomBunny from "./index"; import randomBunny from "./index";
import ICliOptions from "./contracts/ICliOptions"; import ICliOptions from "./contracts/ICliOptions";
import { exit } from "process"; import { exit } from "process";
@ -10,13 +10,15 @@ program
.description('Get a random image url from a subreddit of your choosing') .description('Get a random image url from a subreddit of your choosing')
.version('2.2') .version('2.2')
.option('-s, --subreddit <subreddit>', 'The subreddit to search', 'rabbits') .option('-s, --subreddit <subreddit>', 'The subreddit to search', 'rabbits')
.option('-j, --json', 'Output as JSON'); .option('-j, --json', 'Output as JSON')
.option('-q, --query-metadata', 'Include query metadata in result')
.addOption(new Option('--sort <sort>', 'Sort by').default('hot').choices(['hot', 'new', 'top']));
program.parse(); program.parse();
const options: ICliOptions = program.opts(); const options: ICliOptions = program.opts();
randomBunny(options.subreddit) randomBunny(options.subreddit, options.sort)
.then((response) => { .then((response) => {
if (response.IsSuccess) { if (response.IsSuccess) {
const result = response.Result!; const result = response.Result!;
@ -38,6 +40,11 @@ randomBunny(options.subreddit)
outputLines.push(`Upvotes = ${result.Ups}`); outputLines.push(`Upvotes = ${result.Ups}`);
outputLines.push(`Url = ${result.Url}`); outputLines.push(`Url = ${result.Url}`);
if (options.queryMetadata != null) {
outputLines.push(`Query.Subreddit = ${response.Query.subreddit}`);
outputLines.push(`Query.Sort By = ${response.Query.sortBy}`);
}
console.log(outputLines.join("\n")); console.log(outputLines.join("\n"));
exit(0); exit(0);
} else { } else {

View file

@ -1,4 +1,6 @@
export default interface ICliOptions { export default interface ICliOptions {
subreddit: string, subreddit: string,
json?: boolean, json?: boolean,
sort: string,
queryMetadata?: boolean,
} }

View file

@ -1,8 +1,10 @@
import IError from "./IError.js"; import IError from "./IError.js";
import IRedditResult from "./IRedditResult.js"; import IRedditResult from "./IRedditResult.js";
import QueryResult from "./QueryResult.js";
export default interface IReturnResult { export default interface IReturnResult {
IsSuccess: boolean; IsSuccess: boolean;
Query: QueryResult;
Result?: IRedditResult; Result?: IRedditResult;
Error?: IError; Error?: IError;
} }

View file

@ -0,0 +1,4 @@
export default interface QueryResult {
subreddit: string,
sortBy: string,
}

View file

@ -15,7 +15,7 @@ const sortable = [
export default async function randomBunny(subreddit: string, sortBy: string = 'hot'): Promise<IReturnResult> { export default async function randomBunny(subreddit: string, sortBy: string = 'hot'): Promise<IReturnResult> {
if (!sortable.includes(sortBy)) sortBy = 'hot'; if (!sortable.includes(sortBy)) sortBy = 'hot';
const result = await fetch(`https://reddit.com/r/${subreddit}/${sortBy}.json`) const result = await fetch(`https://reddit.com/r/${subreddit}/${sortBy}.json?limit=100`)
.then((res) => { .then((res) => {
return res; return res;
}) })
@ -26,6 +26,10 @@ export default async function randomBunny(subreddit: string, sortBy: string = 'h
if (!result) { if (!result) {
return { return {
IsSuccess: false, IsSuccess: false,
Query: {
subreddit: subreddit,
sortBy: sortBy,
},
Error: { Error: {
Code: ErrorCode.FailedToFetchReddit, Code: ErrorCode.FailedToFetchReddit,
Message: ErrorMessages.FailedToFetchReddit, Message: ErrorMessages.FailedToFetchReddit,
@ -38,6 +42,10 @@ export default async function randomBunny(subreddit: string, sortBy: string = 'h
if (!json) { if (!json) {
return { return {
IsSuccess: false, IsSuccess: false,
Query: {
subreddit: subreddit,
sortBy: sortBy,
},
Error: { Error: {
Code: ErrorCode.UnableToParseJSON, Code: ErrorCode.UnableToParseJSON,
Message: ErrorMessages.UnableToParseJSON, Message: ErrorMessages.UnableToParseJSON,
@ -56,6 +64,10 @@ export default async function randomBunny(subreddit: string, sortBy: string = 'h
if (dataWithImages.length == 0) { if (dataWithImages.length == 0) {
return { return {
IsSuccess: false, IsSuccess: false,
Query: {
subreddit: subreddit,
sortBy: sortBy,
},
Error: { Error: {
Code: ErrorCode.NoImageResultsFound, Code: ErrorCode.NoImageResultsFound,
Message: ErrorMessages.NoImageResultsFound, Message: ErrorMessages.NoImageResultsFound,
@ -83,6 +95,10 @@ export default async function randomBunny(subreddit: string, sortBy: string = 'h
return { return {
IsSuccess: true, IsSuccess: true,
Query: {
subreddit: subreddit,
sortBy: sortBy,
},
Result: redditResult Result: redditResult
}; };
} }

View file

@ -70,23 +70,23 @@ describe('subreddit', () => {
}, 5000); }, 5000);
test('GIVEN -s is supplied, EXPECT subreddit to be changed', async () => { test('GIVEN -s is supplied, EXPECT subreddit to be changed', async () => {
const result = await cli(['-s', 'horses'], '.'); const result = await cli(['-s', 'pics'], '.');
const subreddit = result.stdout.split('\n') const subreddit = result.stdout.split('\n')
.find(x => x && x.length > 0 && x.split(' = ')[0] == 'Subreddit')! .find(x => x && x.length > 0 && x.split(' = ')[0] == 'Subreddit')!
.split(' = ')[1]; .split(' = ')[1];
expect(subreddit).toBe('Horses'); expect(subreddit).toBe('pics');
}, 5000); }, 5000);
test('GIVEN --subreddit is supplied, EXPECT subreddit to be changed', async () => { test('GIVEN --subreddit is supplied, EXPECT subreddit to be changed', async () => {
const result = await cli(['--subreddit', 'horses'], '.'); const result = await cli(['--subreddit', 'pics'], '.');
const subreddit = result.stdout.split('\n') const subreddit = result.stdout.split('\n')
.find(x => x && x.length > 0 && x.split(' = ')[0] == 'Subreddit')! .find(x => x && x.length > 0 && x.split(' = ')[0] == 'Subreddit')!
.split(' = ')[1]; .split(' = ')[1];
expect(subreddit).toBe('Horses'); expect(subreddit).toBe('pics');
}, 5000); }, 5000);
}); });
@ -108,6 +108,64 @@ describe('json', () => {
}, 5000); }, 5000);
}); });
describe('sort', () => {
test('GIVEN --sort is not supplied, EXPECT sort to be defaulted', async () => {
const result = await cli(['-q'], '.');
const sortBy = result.stdout.split('\n')
.find(x => x && x.length > 0 && x.split(' = ')[0] == 'Query.Sort By')!
.split(' = ')[1];
expect(sortBy).toBe('hot');
}, 5000);
test('GIVEN --sort is supplied WITH a valid input, EXPECT sort to be used', async () => {
const result = await cli(['-q', '--sort', 'new'], '.');
const sortBy = result.stdout.split('\n')
.find(x => x && x.length > 0 && x.split(' = ')[0] == 'Query.Sort By')!
.split(' = ')[1];
expect(sortBy).toBe('new');
}, 5000);
test('GIVEN --sort is supplied WITH an invalid input, EXPECT error', async () => {
const result = await cli(['-q', '--sort', 'invalid'], '.');
expect(result.code).toBe(1);
expect(result.stderr).toBe("error: option '--sort <sort>' argument 'invalid' is invalid. Allowed choices are hot, new, top.\n");
}, 5000);
});
describe('query-metadata', () => {
test('GIVEN --query-metadata is not supplied, EXPECT no query metadata returned', async () => {
const result = await cli([], '.');
const query = result.stdout.split('\n')
.find(x => x && x.length > 0 && x.split(' = ')[0].startsWith('Query'));
expect(query).toBeUndefined();
}, 5000);
test('GIVEN --query-metadata is not supplied, EXPECT no query metadata returned', async () => {
const result = await cli(['--query-metadata'], '.');
const query = result.stdout.split('\n')
.find(x => x && x.length > 0 && x.split(' = ')[0].startsWith('Query'));
expect(query).toBeDefined();
}, 5000);
test('GIVEN -q is not supplied, EXPECT no query metadata returned', async () => {
const result = await cli(['-q'], '.');
const query = result.stdout.split('\n')
.find(x => x && x.length > 0 && x.split(' = ')[0].startsWith('Query'));
expect(query).toBeDefined();
}, 5000);
});
function cli(args: string[], cwd: string): Promise<cliResult> { function cli(args: string[], cwd: string): Promise<cliResult> {
return new Promise(resolve => { return new Promise(resolve => {
exec(`node ${path.resolve('./dist/cli.js')} ${args.join(' ')}`, exec(`node ${path.resolve('./dist/cli.js')} ${args.join(' ')}`,

View file

@ -36,7 +36,7 @@ describe('randomBunny', () => {
expect(result.Result).toBeDefined(); expect(result.Result).toBeDefined();
expect(result.Error).toBeUndefined(); expect(result.Error).toBeUndefined();
expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json'); expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json?limit=100');
}); });
test('GIVEN sortBy is NOT supplied, expect it to default to hot', async () => { test('GIVEN sortBy is NOT supplied, expect it to default to hot', async () => {
@ -68,7 +68,7 @@ describe('randomBunny', () => {
expect(result.Result).toBeDefined(); expect(result.Result).toBeDefined();
expect(result.Error).toBeUndefined(); expect(result.Error).toBeUndefined();
expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/hot.json'); expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/hot.json?limit=100');
}); });
test('GIVEN sortBy is NOT valid, expect it to default to hot', async () => { test('GIVEN sortBy is NOT valid, expect it to default to hot', async () => {
@ -100,7 +100,7 @@ describe('randomBunny', () => {
expect(result.Result).toBeDefined(); expect(result.Result).toBeDefined();
expect(result.Error).toBeUndefined(); expect(result.Error).toBeUndefined();
expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/hot.json'); expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/hot.json?limit=100');
}); });
test('GIVEN the fetch fails, EXPECT failure result', async () => { test('GIVEN the fetch fails, EXPECT failure result', async () => {
@ -115,7 +115,7 @@ describe('randomBunny', () => {
expect(result.Error!.Code).toBe(ErrorCode.FailedToFetchReddit); expect(result.Error!.Code).toBe(ErrorCode.FailedToFetchReddit);
expect(result.Error!.Message).toBe(ErrorMessages.FailedToFetchReddit); expect(result.Error!.Message).toBe(ErrorMessages.FailedToFetchReddit);
expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json'); expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json?limit=100');
}); });
test('GIVEN the result is NOT valid JSON, EXPECT failure result', async () => { test('GIVEN the result is NOT valid JSON, EXPECT failure result', async () => {
@ -132,7 +132,7 @@ describe('randomBunny', () => {
expect(result.Error!.Code).toBe(ErrorCode.UnableToParseJSON); expect(result.Error!.Code).toBe(ErrorCode.UnableToParseJSON);
expect(result.Error!.Message).toBe(ErrorMessages.UnableToParseJSON); expect(result.Error!.Message).toBe(ErrorMessages.UnableToParseJSON);
expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json'); expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json?limit=100');
}); });
test('GIVEN randomSelect does NOT find a response, EXPECT failure result', async () => { test('GIVEN randomSelect does NOT find a response, EXPECT failure result', async () => {
@ -153,7 +153,7 @@ describe('randomBunny', () => {
expect(result.Error!.Code).toBe(ErrorCode.NoImageResultsFound); expect(result.Error!.Code).toBe(ErrorCode.NoImageResultsFound);
expect(result.Error!.Message).toBe(ErrorMessages.NoImageResultsFound); expect(result.Error!.Message).toBe(ErrorMessages.NoImageResultsFound);
expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json'); expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json?limit=100');
}); });
test('GIVEN randomSelect does NOT find a valid response, EXPECT failure result', async () => { test('GIVEN randomSelect does NOT find a valid response, EXPECT failure result', async () => {
@ -188,6 +188,6 @@ describe('randomBunny', () => {
expect(result.Error!.Code).toBe(ErrorCode.NoImageResultsFound); expect(result.Error!.Code).toBe(ErrorCode.NoImageResultsFound);
expect(result.Error!.Message).toBe(ErrorMessages.NoImageResultsFound); expect(result.Error!.Message).toBe(ErrorMessages.NoImageResultsFound);
expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json'); expect(fetchMock).toBeCalledWith('https://reddit.com/r/rabbits/new.json?limit=100');
}); });
}); });

865
yarn.lock

File diff suppressed because it is too large Load diff