diff --git a/services/appveyor/appveyor-tests.service.js b/services/appveyor/appveyor-tests.service.js
index 465130445e..6b8951db3c 100644
--- a/services/appveyor/appveyor-tests.service.js
+++ b/services/appveyor/appveyor-tests.service.js
@@ -1,31 +1,10 @@
import {
testResultQueryParamSchema,
renderTestResultBadge,
+ documentation,
} from '../test-results.js'
import AppVeyorBase from './appveyor-base.js'
-const documentation = `
-
- You may change the "passed", "failed" and "skipped" text on this badge by supplying query parameters &passed_label=, &failed_label= and &skipped_label= respectively.
-
-
-
- For example, if you want to use a different terminology:
-
- /appveyor/tests/NZSmartie/coap-net-iu0to.svg?passed_label=good&failed_label=bad&skipped_label=n%2Fa
-
-
-
- Or symbols:
-
- /appveyor/tests/NZSmartie/coap-net-iu0to.svg?compact_message&passed_label=%F0%9F%8E%89&failed_label=%F0%9F%92%A2&skipped_label=%F0%9F%A4%B7
-
-
-
- There is also a &compact_message query parameter, which will default to displaying ✔, ✘ and ➟, separated by a horizontal bar |.
-
-`
-
const commonPreviewProps = {
passed: 477,
failed: 2,
diff --git a/services/appveyor/appveyor-tests.tester.js b/services/appveyor/appveyor-tests.tester.js
index 102f532d29..2c3f564df1 100644
--- a/services/appveyor/appveyor-tests.tester.js
+++ b/services/appveyor/appveyor-tests.tester.js
@@ -1,38 +1,26 @@
-import queryString from 'querystring'
-import Joi from 'joi'
+import {
+ isDefaultTestTotals,
+ isDefaultCompactTestTotals,
+ isCustomTestTotals,
+ isCustomCompactTestTotals,
+} from '../test-validators.js'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
-const isAppveyorTestTotals = Joi.string().regex(
- /^[0-9]+ passed(, [0-9]+ failed)?(, [0-9]+ skipped)?$/
-)
-
-const isCompactAppveyorTestTotals = Joi.string().regex(
- /^✔ [0-9]+( \| ✘ [0-9]+)?( \| ➟ [0-9]+)?$/
-)
-
-const isCustomAppveyorTestTotals = Joi.string().regex(
- /^[0-9]+ good(, [0-9]+ bad)?(, [0-9]+ n\/a)?$/
-)
-
-const isCompactCustomAppveyorTestTotals = Joi.string().regex(
- /^💃 [0-9]+( \| 🤦♀️ [0-9]+)?( \| 🤷 [0-9]+)?$/
-)
-
t.create('Test status')
.timeout(10000)
.get('/NZSmartie/coap-net-iu0to.json')
- .expectBadge({ label: 'tests', message: isAppveyorTestTotals })
+ .expectBadge({ label: 'tests', message: isDefaultTestTotals })
t.create('Test status on branch')
.timeout(10000)
.get('/NZSmartie/coap-net-iu0to/master.json')
- .expectBadge({ label: 'tests', message: isAppveyorTestTotals })
+ .expectBadge({ label: 'tests', message: isDefaultTestTotals })
t.create('Test status with compact message')
.timeout(10000)
.get('/NZSmartie/coap-net-iu0to.json?compact_message')
- .expectBadge({ label: 'tests', message: isCompactAppveyorTestTotals })
+ .expectBadge({ label: 'tests', message: isDefaultCompactTestTotals })
t.create('Test status with custom labels')
.timeout(10000)
@@ -43,21 +31,21 @@ t.create('Test status with custom labels')
skipped_label: 'n/a',
},
})
- .expectBadge({ label: 'tests', message: isCustomAppveyorTestTotals })
+ .expectBadge({ label: 'tests', message: isCustomTestTotals })
t.create('Test status with compact message and custom labels')
.timeout(10000)
- .get(
- `/NZSmartie/coap-net-iu0to.json?${queryString.stringify({
+ .get('/NZSmartie/coap-net-iu0to.json', {
+ qs: {
compact_message: null,
passed_label: '💃',
failed_label: '🤦♀️',
skipped_label: '🤷',
- })}`
- )
+ },
+ })
.expectBadge({
label: 'tests',
- message: isCompactCustomAppveyorTestTotals,
+ message: isCustomCompactTestTotals,
})
t.create('Test status on non-existent project')