Skip to content

Commit

Permalink
Fix test error caused by gifwrap module
Browse files Browse the repository at this point in the history
  • Loading branch information
Saeris committed Jun 26, 2021
1 parent fac733e commit 8340e30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ module.exports = {
"\\.(gql|graphql)$": `jest-transform-graphql`,
"^.+\\.(js|ts)x?$": `babel-jest`
},
modulePathIgnorePatterns: ["<rootDir>/pkg"],
verbose: true
}
13 changes: 12 additions & 1 deletion src/__TEST__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import { handler } from "../../lambda/tmdb-api"

const wait = async (ms = 0) =>
new Promise((resolve) => {
setTimeout(resolve, ms)
})

describe(`handler`, () => {
it(`should be a function`, () => {
it(`should be a function`, async () => {
expect(typeof handler).toBe(`function`)
// Dumb workaround for Jimp because of dynamic dependency loading in this file:
// https://github.com/jtlapp/gifwrap/blob/da9b9ca6f3261f3d06ba1d101059463774ddd12c/src/gifcodec.js#L6-L8
// For solution, see: https://github.com/facebook/jest/issues/6434#issuecomment-689083905
// Also referencing: https://stackoverflow.com/questions/67178109/jest-throwing-reference-error-about-an-import-inside-a-node-modules-dependency
await wait()
await wait()
})
})

0 comments on commit 8340e30

Please sign in to comment.