Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Commit

Permalink
Merge dd3f2fc into 2861af2
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Jan 19, 2021
2 parents 2861af2 + dd3f2fc commit 2c12320
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 55 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
run: npm run lint:prettier:ci
- name: Run License Checker
run: npm run license-checker
- name: Run Lockfile Linter
run: npx lockfile-lint --path package-lock.json --type npm --allowed-hosts npm --validate-https

unit-tests:
name: Unit Tests
Expand Down
25 changes: 5 additions & 20 deletions src/routes/documents/receipt/receipt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ describe("receipt", () => {

const response = await server.inject({
method: "DELETE",
url: "/",
params: {
id: mockId,
},
url: `/${mockId}`,
query: {
patientId: mockPatientId,
},
Expand All @@ -66,10 +63,7 @@ describe("receipt", () => {

const response = await server.inject({
method: "DELETE",
url: "/",
params: {
id: mockId,
},
url: `/${mockId}`,
query: {
patientId: mockPatientId,
},
Expand All @@ -90,10 +84,7 @@ describe("receipt", () => {

const response = await server.inject({
method: "DELETE",
url: "/",
params: {
id: mockId,
},
url: `/${mockId}`,
query: {
patientId: mockPatientId,
},
Expand Down Expand Up @@ -132,10 +123,7 @@ describe("receipt", () => {

const response = await server.inject({
method: "PUT",
url: "/",
params: {
id: mockId,
},
url: `/${mockId}`,
query: {
patientId: mockPatientId,
timestamp: mockTimeStamp,
Expand All @@ -157,10 +145,7 @@ describe("receipt", () => {

const response = await server.inject({
method: "PUT",
url: "/",
params: {
id: mockId,
},
url: `/${mockId}`,
query: {
patientId: mockPatientId,
timestamp: mockTimeStamp,
Expand Down
6 changes: 4 additions & 2 deletions src/routes/documents/receipt/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const receiptDeleteSchema = {
"id",
S.string()
.description("Logical id of the artifact")
.examples(["EXAMPLE-GUID"])
.examples(["EXAMPLEGUID-0123456789-99999"])
.pattern("^[a-zA-Z0-9\\-]{1,36}$")
.required()
),
query: S.object().prop(
Expand Down Expand Up @@ -49,7 +50,8 @@ const receiptPutSchema = {
"id",
S.string()
.description("Logical id of the artifact")
.examples(["EXAMPLE-GUID"])
.examples(["EXAMPLEGUID-0123456789-99999"])
.pattern("^[a-zA-Z0-9\\-]{1,36}$")
.required()
),
query: S.object()
Expand Down
8 changes: 4 additions & 4 deletions src/routes/documents/register/register.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ describe("register", () => {
],
[
{
GUID: "EXAMPLE-GUID",
GUID: "EXAMPLEGUID-0123456789-99999",
fhirId: "99999",
title: "99999 DUCK 11 July 2015 11 27.pdf",
clinic: "CLO/BIA",
documentType: "Clinic Letter",
fileName: "99999 DUCK 11 July 2015 11 27.pdf",
fullPath: "./path/path/path",
URL:
"https://notreal.ydh.nhs.uk/sites/MedicalRecords1/_layouts/15/DocIdRedir.aspx?ID=EXAMPLE-GUID",
"https://notreal.ydh.nhs.uk/sites/MedicalRecords1/_layouts/15/DocIdRedir.aspx?ID=EXAMPLEGUID-0123456789-99999",
CreatedDate: "2015-09-30T05:40:14.000Z",
Modified: "2020-08-10T03:51:54.000Z",
Specialty: "General Surgery",
Expand Down Expand Up @@ -91,15 +91,15 @@ describe("register", () => {
],
[
{
GUID: "EXAMPLE-GUID",
GUID: "EXAMPLEGUID-0123456789-99999",
fhirId: "99999",
title: "99999 DUCK 11 July 2015 11 27.pdf",
clinic: "CLO/BIA",
documentType: "Clinic Letter",
fileName: "99999 DUCK 11 July 2015 11 27.pdf",
fullPath: "./path/path/path",
URL:
"https://notreal.ydh.nhs.uk/sites/MedicalRecords1/_layouts/15/DocIdRedir.aspx?ID=EXAMPLE-GUID",
"https://notreal.ydh.nhs.uk/sites/MedicalRecords1/_layouts/15/DocIdRedir.aspx?ID=EXAMPLEGUID-0123456789-99999",
CreatedDate: "2015-09-30T05:40:14.000Z",
Modified: "2020-08-10T03:51:54.000Z",
Specialty: "General Surgery",
Expand Down
9 changes: 7 additions & 2 deletions src/routes/documents/register/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ const registerGetSchema = {
"data",
S.array().items(
S.object()
.prop("guid", S.string().examples(["EXAMPLE-GUID"]))
.prop(
"guid",
S.string().examples([
"EXAMPLEGUID-0123456789-99999",
])
)
.prop("fhirId", S.string().examples(["99999"]))
.prop(
"title",
Expand Down Expand Up @@ -76,7 +81,7 @@ const registerGetSchema = {
"url",
S.string()
.examples([
"https://notreal.ydh.nhs.uk/sites/MedicalRecords1/_layouts/15/DocIdRedir.aspx?ID=EXAMPLE-GUID",
"https://notreal.ydh.nhs.uk/sites/MedicalRecords1/_layouts/15/DocIdRedir.aspx?ID=EXAMPLEGUID-0123456789-99999",
])
.format("uri")
)
Expand Down
4 changes: 1 addition & 3 deletions src/routes/healthcheck/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ const { healthcheckGetSchema } = require("./schema");
* This is used by monitoring software to poll and confirm the API is running,
* so needs no authentication.
* @param {Function} server - Fastify instance.
* @param {object} options - Object containing route config objects.
*/
// eslint-disable-next-line no-unused-vars
async function route(server, options) {
async function route(server) {
server.route({
method: "GET",
url: "/healthcheck",
Expand Down
4 changes: 2 additions & 2 deletions src/routes/preferences/user/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const userGetSchema = {
S.string()
.description("Unique patient identifier")
.examples([1])
.pattern("^\\d*$")
.pattern("^\\d{1,10}$")
),
response: {
404: S.object()
Expand All @@ -43,7 +43,7 @@ const userPutSchema = {
S.string()
.description("Unique patient identifier")
.examples([1])
.pattern("^\\d*$")
.pattern("^\\d{1,10}$")
),
body: S.object().prop(
"preferences",
Expand Down
29 changes: 7 additions & 22 deletions src/routes/preferences/user/user.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ describe("user", () => {

const response = await server.inject({
method: "GET",
url: "/",
params: {
id: mockPatientId,
},
url: `/${mockPatientId}`,
});

expect(mockQueryFn).toHaveBeenCalledTimes(1);
Expand All @@ -84,10 +81,7 @@ describe("user", () => {

const response = await server.inject({
method: "GET",
url: "/",
params: {
id: mockPatientId,
},
url: `/${mockPatientId}`,
});

expect(mockQueryFn).toHaveBeenCalledTimes(1);
Expand All @@ -105,10 +99,7 @@ describe("user", () => {

const response = await server.inject({
method: "GET",
url: "/",
params: {
id: mockPatientId,
},
url: `/${mockPatientId}`,
});

expect(mockQueryFn).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -144,14 +135,11 @@ describe("user", () => {

const response = await server.inject({
method: "PUT",
url: "/",
params: {
id: mockPatientId,
},
url: `/${mockPatientId}`,
headers: {
"content-type": "application/json",
},
body: {
payload: {
preferences: [
{
id: 1,
Expand Down Expand Up @@ -182,14 +170,11 @@ describe("user", () => {

const response = await server.inject({
method: "PUT",
url: "/",
params: {
id: mockPatientId,
},
url: `/${mockPatientId}`,
headers: {
"content-type": "application/json",
},
body: {
payload: {
preferences: [
{
id: 1,
Expand Down

0 comments on commit 2c12320

Please sign in to comment.