Skip to content

Commit

Permalink
fix: renterd no recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Aug 27, 2024
1 parent 3fc5db6 commit 01017ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/small-cameras-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

The recommendations now say "no recommendations" instead of 0. Closes https://github.com/SiaFoundation/desktop/issues/90
10 changes: 5 additions & 5 deletions apps/renterd-e2e/src/specs/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ test('system offers recommendations', async ({ page }) => {

await expect(
page.getByText(
/(0 recommendations to match with more hosts|Configuration matches with a sufficient number of hosts)/
/(No recommendations to match with more hosts|Configuration matches with a sufficient number of hosts)/
)
).toBeVisible()

Expand All @@ -294,7 +294,7 @@ test('system offers recommendations', async ({ page }) => {
await clearToasts({ page })
// There are now recommendations.
await expect(
page.getByText('0 recommendations to match with more hosts')
page.getByText('No recommendations to match with more hosts')
).toBeHidden()

// Apply all recommendations.
Expand Down Expand Up @@ -347,7 +347,7 @@ test('recommendations work with pinned fields', async ({ page }) => {
await fillTextInputByName(page, 'maxDownloadPriceTB', '100')
// There are now recommendations.
await expect(
page.getByText('0 recommendations to match with more hosts')
page.getByText('No recommendations to match with more hosts')
).toBeHidden()

// Set to high mixed values that will not need any recommendations.
Expand All @@ -357,14 +357,14 @@ test('recommendations work with pinned fields', async ({ page }) => {
await fillTextInputByName(page, 'maxDownloadPriceTB', '100000000')
await expect(
page.getByText(
/(0 recommendations to match with more hosts|Configuration matches with a sufficient number of hosts)/
/(No recommendations to match with more hosts|Configuration matches with a sufficient number of hosts)/
)
).toBeVisible()

// Set the pinned max storage price to a low USD value equivalent to 100 SC.
await fillTextInputByName(page, 'maxStoragePriceTBMonthPinned', '0.39')
// There are now recommendations again.
await expect(
page.getByText('0 recommendations to match with more hosts')
page.getByText('No recommendations to match with more hosts')
).toBeHidden()
})
4 changes: 3 additions & 1 deletion apps/renterd/components/Config/Recommendations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ export function Recommendations() {
{usableHostsCurrent}/{hostTarget50}
</Text>
<Text size="16" weight="medium">
{recommendations.length === 1
{recommendations.length === 0
? 'No recommendations'
: recommendations.length === 1
? '1 recommendation'
: `${recommendations.length} recommendations`}{' '}
to match with more hosts
Expand Down

0 comments on commit 01017ce

Please sign in to comment.