Skip to content

Commit 1e7382b

Browse files
committed
Avoid trying to make arrays with length -1, correct inadvertent omission of some tests
1 parent 10fca47 commit 1e7382b

File tree

6 files changed

+12
-5
lines changed

6 files changed

+12
-5
lines changed

.github/workflows/check-external-links.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ jobs:
5656
uses: jbangdev/[email protected]
5757
if: always() # we *especially* want to run this if the link checker failed
5858
with:
59-
script: util/dead-link-issue.java
59+
script: site-validation/dead-link-issue.java
6060
scriptargs: token=${{ secrets.GITHUB_TOKEN }} issueRepo=${{ github.repository }} runId=${{ github.run_id }} siteUrl=https://quarkus.io/extensions

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@
103103
"start": "cp ./node_modules/gatsby-page-utils/dist/apply-trailing-slash-option.js ./node_modules/gatsby-page-utils && gatsby develop",
104104
"serve": "gatsby serve",
105105
"clean": "gatsby clean",
106-
"test": "ACTIVE_ENV=test SUPPRESS_ENV_OUTPUT=true jest --testPathIgnorePatterns test-integration/ --testPathIgnorePatterns util/",
107-
"test:watch": "ACTIVE_ENV=test SUPPRESS_ENV_OUTPUT=true jest --watch --testPathIgnorePatterns test-integration/ --testPathIgnorePatterns util/",
106+
"test": "ACTIVE_ENV=test SUPPRESS_ENV_OUTPUT=true jest --testPathIgnorePatterns test-integration/ --testPathIgnorePatterns site-validation/",
107+
"test:watch": "ACTIVE_ENV=test SUPPRESS_ENV_OUTPUT=true jest --watch --testPathIgnorePatterns test-integration/ --testPathIgnorePatterns site-validation/",
108108
"test:int": "echo '--- Do not forget to run \u001b[1mgatsby build\u001b[0m before running integration tests! ---' && jest --config=jest.integration.config.js test-integration/",
109-
"test:links": "echo '--- Do not forget to run \u001b[1mgatsby build\u001b[0m before running integration tests! ---' && jest --config=jest.integration.config.js util/external-links.test.js"
109+
"test:links": "echo '--- Do not forget to run \u001b[1mgatsby build\u001b[0m before running integration tests! ---' && jest --config=jest.integration.config.js site-validation/external-links.test.js"
110110
}
111111
}
File renamed without changes.
File renamed without changes.

src/components/util/styles/style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const getPalette = (n, baseCode) => {
2020
// Do a cyclical range of colours, from coloured down to white, then through shades of grey, then black from black to coloured
2121
// In pie charts, thin widges tend to look white because of the border, no matter what colour we set
2222
const colouredElements = Math.max(Math.round(n / 3) + 1, 6)
23-
const greyElements = n - 2 * colouredElements
23+
const greyElements = Math.max(0, n - 2 * colouredElements)
2424
const colouredIncrement = 100 / (2 * colouredElements)
2525
const greyIncrement = 100 / greyElements
2626

src/components/util/styles/style.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ describe("the styles helper", () => {
1212
expect(palette[0]).toBe(QUARKUS_BLUE)
1313
})
1414

15+
it("can handle palettes with odd lengths", () => {
16+
const len = 11
17+
const palette = getPalette(len, QUARKUS_BLUE)
18+
expect(palette).toHaveLength(len + 1) // As the length is odd and below 12, we get an even-length palette
19+
expect(palette[0]).toBe(QUARKUS_BLUE)
20+
})
21+
1522
it("returns palettes of the correct length", () => {
1623
expect(getPalette(6)).toHaveLength(6)
1724
expect(getPalette(14)).toHaveLength(14)

0 commit comments

Comments
 (0)