Skip to content

Commit 4a9e5c9

Browse files
authored
Merge pull request #496 from LD4P/update-dependencies
Update dependencies
2 parents 14b32a6 + 36087ba commit 4a9e5c9

22 files changed

Lines changed: 18854 additions & 9548 deletions

__tests__/__mocks__/aws.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const requestMarc = jest.fn()
2+
const hasMarc = jest.fn()
3+
const getMarc = jest.fn()
4+
const listGroups = jest.fn()
5+
const buildAndSendSqsMessage = jest.fn()
6+
const detectLanguage = jest.fn()
7+
8+
module.exports = {
9+
requestMarc,
10+
hasMarc,
11+
getMarc,
12+
listGroups,
13+
buildAndSendSqsMessage,
14+
detectLanguage,
15+
}

__tests__/app.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import request from "supertest"
22
import app from "app.js"
33

44
jest.mock("mongo.js")
5+
// eslint-disable-next-line global-require
6+
jest.mock("aws.js", () => require("./__mocks__/aws.js"))
57

68
describe("GET /", () => {
79
it("returns health check", async () => {

__tests__/aws.cognito.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import {
66
} from "@aws-sdk/client-cognito-identity-provider"
77
import { listGroups } from "aws.js"
88

9+
jest.mock("@aws-sdk/client-sqs", () => ({ SQSClient: jest.fn() }))
10+
jest.mock("@aws-sdk/client-s3", () => ({ S3Client: jest.fn() }))
11+
jest.mock("@aws-sdk/client-lambda", () => ({ LambdaClient: jest.fn() }))
12+
jest.mock("@aws-sdk/client-comprehend", () => ({ ComprehendClient: jest.fn() }))
913
jest.mock("@aws-sdk/client-cognito-identity-provider", () => {
1014
const mockCognitoIdentityProviderClient = jest.fn()
1115
const mockPaginateListGroups = jest.fn()

__tests__/aws.comprehend.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ import {
55
} from "@aws-sdk/client-comprehend"
66
import { detectLanguage } from "aws.js"
77

8+
jest.mock("@aws-sdk/client-cognito-identity-provider", () => ({
9+
CognitoIdentityProviderClient: jest.fn(),
10+
paginateListGroups: jest.fn(),
11+
}))
12+
jest.mock("@aws-sdk/client-sqs", () => ({ SQSClient: jest.fn() }))
13+
jest.mock("@aws-sdk/client-s3", () => ({ S3Client: jest.fn() }))
14+
jest.mock("@aws-sdk/client-lambda", () => ({ LambdaClient: jest.fn() }))
815
jest.mock("@aws-sdk/client-comprehend", () => {
916
const mockSend = jest.fn()
1017
return {

__tests__/aws.marc.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import {
1111
import { requestMarc, hasMarc, getMarc } from "aws.js"
1212
import { Readable } from "stream"
1313

14+
jest.mock("@aws-sdk/client-cognito-identity-provider", () => ({
15+
CognitoIdentityProviderClient: jest.fn(),
16+
paginateListGroups: jest.fn(),
17+
}))
18+
jest.mock("@aws-sdk/client-sqs", () => ({ SQSClient: jest.fn() }))
19+
jest.mock("@aws-sdk/client-comprehend", () => ({ ComprehendClient: jest.fn() }))
1420
jest.mock("@aws-sdk/client-s3", () => {
1521
const mockSend = jest.fn()
1622
return {

__tests__/aws.sqs.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ import {
66
} from "@aws-sdk/client-sqs"
77
import { buildAndSendSqsMessage } from "aws.js"
88

9+
jest.mock("@aws-sdk/client-cognito-identity-provider", () => ({
10+
CognitoIdentityProviderClient: jest.fn(),
11+
paginateListGroups: jest.fn(),
12+
}))
13+
jest.mock("@aws-sdk/client-s3", () => ({ S3Client: jest.fn() }))
14+
jest.mock("@aws-sdk/client-lambda", () => ({ LambdaClient: jest.fn() }))
15+
jest.mock("@aws-sdk/client-comprehend", () => ({ ComprehendClient: jest.fn() }))
916
jest.mock("@aws-sdk/client-sqs", () => {
1017
const mockSend = jest.fn()
1118
return {

__tests__/endpoints/groups.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import request from "supertest"
22
import app from "app.js"
33
import * as aws from "aws.js"
44

5-
jest.mock("aws.js")
5+
// eslint-disable-next-line global-require
6+
jest.mock("aws.js", () => require("../__mocks__/aws.js"))
67

78
describe("GET /groups", () => {
89
const groups = [

__tests__/endpoints/helpers.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import request from "supertest"
22
import app from "app.js"
33
import * as aws from "aws.js"
44

5-
jest.mock("aws.js")
5+
// eslint-disable-next-line global-require
6+
jest.mock("aws.js", () => require("../__mocks__/aws.js"))
67
jest.mock("jwt.js", () => {
78
return {
89
__esModule: true,

__tests__/endpoints/marcGet.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import request from "supertest"
22
import app from "app.js"
33
import * as aws from "aws.js"
44

5-
jest.mock("aws.js")
5+
// eslint-disable-next-line global-require
6+
jest.mock("aws.js", () => require("../__mocks__/aws.js"))
67

78
describe("GET /:resourceId/job/:username/:timestamp", () => {
89
describe("MARC does not exist", () => {

__tests__/endpoints/marcPost.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ resource.timestamp = new Date(resource.timestamp)
99
// Multiple files.
1010

1111
jest.mock("mongo.js")
12-
jest.mock("aws.js")
12+
// eslint-disable-next-line global-require
13+
jest.mock("aws.js", () => require("../__mocks__/aws.js"))
1314
jest.mock("jwt.js", () => {
1415
return {
1516
__esModule: true,

0 commit comments

Comments
 (0)