Add tests as a Docker build step to ensure no container with failing tests can be published
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
parent
ab2aa09861
commit
5504439ce0
@ -3,6 +3,8 @@ WORKDIR /usr/src/app
|
|||||||
COPY ./package*.json ./
|
COPY ./package*.json ./
|
||||||
RUN npm i
|
RUN npm i
|
||||||
COPY . .
|
COPY . .
|
||||||
|
# Ideally the tests should be run separately in a CI/CD workflow rather than during the build
|
||||||
|
RUN npm run test
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-slim
|
FROM node:20-slim
|
||||||
|
22
package-lock.json
generated
22
package-lock.json
generated
@ -24,7 +24,7 @@
|
|||||||
"zlib": "^1.0.5"
|
"zlib": "^1.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@owlboard/ts-types": "^0.0.3",
|
"@owlboard/ts-types": "^0.0.5",
|
||||||
"@types/jest": "^29.5.3",
|
"@types/jest": "^29.5.3",
|
||||||
"eslint": "^8.39.0",
|
"eslint": "^8.39.0",
|
||||||
"jest": "^29.6.2",
|
"jest": "^29.6.2",
|
||||||
@ -1855,9 +1855,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@owlboard/ts-types": {
|
"node_modules/@owlboard/ts-types": {
|
||||||
"version": "0.0.3",
|
"version": "0.0.5",
|
||||||
"resolved": "https://git.fjla.uk/api/packages/OwlBoard/npm/%40owlboard%2Fts-types/-/0.0.3/ts-types-0.0.3.tgz",
|
"resolved": "https://git.fjla.uk/api/packages/OwlBoard/npm/%40owlboard%2Fts-types/-/0.0.5/ts-types-0.0.5.tgz",
|
||||||
"integrity": "sha512-7PvFVNzYhIRsYxGPWLQVg1ldMSI0H6a5DA0WJ8dNT3boL+PREZybxA4rWUUKkcND+ct/nO8xax2SODYcWjY7Hw==",
|
"integrity": "sha512-MuQlBydSXjHZIKQa6RgCdvDwHjFfG1wJXHioXPQno6GEdsxaDDoN06JCDkPf/l+hPjK/jMYrNNmVI1l5ZorYcg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "GPL-3.0-or-later"
|
"license": "GPL-3.0-or-later"
|
||||||
},
|
},
|
||||||
@ -3964,20 +3964,6 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/fsevents": {
|
|
||||||
"version": "2.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
|
||||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
|
||||||
"dev": true,
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/function-bind": {
|
"node_modules/function-bind": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
"zlib": "^1.0.5"
|
"zlib": "^1.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@owlboard/ts-types": "^0.0.3",
|
"@owlboard/ts-types": "^0.0.5",
|
||||||
"@types/jest": "^29.5.3",
|
"@types/jest": "^29.5.3",
|
||||||
"eslint": "^8.39.0",
|
"eslint": "^8.39.0",
|
||||||
"jest": "^29.6.2",
|
"jest": "^29.6.2",
|
||||||
|
@ -89,10 +89,11 @@ function transformTrainServices(input: any): TrainServices[] {
|
|||||||
function transformLocation(input: any): ServiceLocation[] {
|
function transformLocation(input: any): ServiceLocation[] {
|
||||||
console.debug(`staffStation.transformLocation running`)
|
console.debug(`staffStation.transformLocation running`)
|
||||||
let output: ServiceLocation[] = []
|
let output: ServiceLocation[] = []
|
||||||
if (!Array.isArray(input)) {
|
let locations: any[] = input.location
|
||||||
input = [input]
|
if (!Array.isArray(input.location)) {
|
||||||
|
locations = [input.location]
|
||||||
}
|
}
|
||||||
for (const item of input) {
|
for (const item of locations) {
|
||||||
const location: ServiceLocation = {
|
const location: ServiceLocation = {
|
||||||
tiploc: item?.tiploc,
|
tiploc: item?.tiploc,
|
||||||
name: item?.locationName
|
name: item?.locationName
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
export const outputs: any[] = [
|
import type { StaffLdb, NrccMessage, TrainServices,
|
||||||
|
ServiceLocation } from '@owlboard/ts-types';
|
||||||
|
|
||||||
|
export const outputs: StaffLdb[] = [
|
||||||
{
|
{
|
||||||
generatedAt: expect.any(Date),
|
generatedAt: expect.any(Date),
|
||||||
locationName: "Railway Station",
|
locationName: "Railway Station",
|
||||||
@ -25,13 +28,13 @@ export const outputs: any[] = [
|
|||||||
origin: [
|
origin: [
|
||||||
{
|
{
|
||||||
tiploc: "PLYMTH",
|
tiploc: "PLYMTH",
|
||||||
locationName: "Plymouth"
|
name: "Plymouth"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
destination: [
|
destination: [
|
||||||
{
|
{
|
||||||
tiploc: "BHAMNWS",
|
tiploc: "BHAMNWS",
|
||||||
locationName: "Birmingham New Street"
|
name: "Birmingham New Street"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user