Skip to content

Commit

Permalink
chore(deps): Update pdfmake version to 0.2.15 (#15230)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency pdfmake to v0.2.15

* fix usage in receipts

* add mocks in tests

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
0xTxbi and renovate[bot] authored Dec 3, 2024
1 parent eb2c2e2 commit b9cb807
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 18 deletions.
16 changes: 16 additions & 0 deletions locksmith/__tests__/controllers/v2/eventCasterController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ vi.mock('../../../src/worker/worker', () => ({
addJob: vi.fn().mockResolvedValue(Promise.resolve(true)),
}))

// mock pdfmake
vi.mock('pdfmake/build/pdfmake', () => ({
default: {
vfs: {},
createPdf: vi.fn(),
},
}))

vi.mock('pdfmake/build/vfs_fonts', () => ({
default: {
pdfMake: {
vfs: {},
},
},
}))

// https://events.xyz/api/v1/event?event_id=195ede7f
const eventCasterEvent = {
contract: {
Expand Down
16 changes: 16 additions & 0 deletions locksmith/__tests__/controllers/v2/keyController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ import { loginRandomUser } from '../../test-helpers/utils'
import app from '../../app'
import { vi, expect } from 'vitest'

// mock pdfmake
vi.mock('pdfmake/build/pdfmake', () => ({
default: {
vfs: {},
createPdf: vi.fn(),
},
}))

vi.mock('pdfmake/build/vfs_fonts', () => ({
default: {
pdfMake: {
vfs: {},
},
},
}))

const lockAddress = '0x62CcB13A72E6F991dE53b9B7AC42885151588Cd2'
const wrongLockAddress = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
const network = 4
Expand Down
2 changes: 1 addition & 1 deletion locksmith/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"p-retry": "6.2.1",
"passkit-generator": "3.2.0",
"path-to-regexp": "8.2.0",
"pdfmake": "0.2.14",
"pdfmake": "0.2.15",
"pg": "8.13.1",
"rate-limiter-flexible": "5.0.4",
"react": "18.3.1",
Expand Down
3 changes: 2 additions & 1 deletion locksmith/src/utils/receipts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { TDocumentDefinitions } from 'pdfmake/interfaces'
import { Receipt, ReceiptBase } from '../models'
import { getWeb3Service } from '../initializers'

pdfmake.vfs = pdfFonts.pdfMake.vfs
// @ts-ignore
pdfmake.vfs = pdfFonts.pdfMake ? pdfFonts.pdfMake.vfs : pdfFonts.vfs

export const getAllReceipts = async ({
network,
Expand Down
40 changes: 24 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6288,7 +6288,7 @@ __metadata:
languageName: node
linkType: hard

"@foliojs-fork/fontkit@npm:^1.9.1":
"@foliojs-fork/fontkit@npm:^1.9.2":
version: 1.9.2
resolution: "@foliojs-fork/fontkit@npm:1.9.2"
dependencies:
Expand All @@ -6304,7 +6304,7 @@ __metadata:
languageName: node
linkType: hard

"@foliojs-fork/linebreak@npm:^1.1.1":
"@foliojs-fork/linebreak@npm:^1.1.1, @foliojs-fork/linebreak@npm:^1.1.2":
version: 1.1.2
resolution: "@foliojs-fork/linebreak@npm:1.1.2"
dependencies:
Expand All @@ -6314,15 +6314,16 @@ __metadata:
languageName: node
linkType: hard

"@foliojs-fork/pdfkit@npm:^0.14.0":
version: 0.14.0
resolution: "@foliojs-fork/pdfkit@npm:0.14.0"
"@foliojs-fork/pdfkit@npm:^0.15.1":
version: 0.15.1
resolution: "@foliojs-fork/pdfkit@npm:0.15.1"
dependencies:
"@foliojs-fork/fontkit": "npm:^1.9.1"
"@foliojs-fork/fontkit": "npm:^1.9.2"
"@foliojs-fork/linebreak": "npm:^1.1.1"
crypto-js: "npm:^4.2.0"
jpeg-exif: "npm:^1.1.4"
png-js: "npm:^1.0.0"
checksum: 10/d0670a3510287376dedd72deddd2980b8c2394685c5ec057afc35148987befb5a45a99bc07942dcd5fe4044933caeba028e169dfc562bf69848fb9d8d33e49c6
checksum: 10/00c9cfbbde97a0c2d0cfd4521df55106683f2561eba1253d10e5d790af38ed6fe141fa333ef245f6386f65adb26e9839102cde09f4a106b0920c543259733a1d
languageName: node
linkType: hard

Expand Down Expand Up @@ -18383,7 +18384,7 @@ __metadata:
parse-data-uri: "npm:0.2.0"
passkit-generator: "npm:3.2.0"
path-to-regexp: "npm:8.2.0"
pdfmake: "npm:0.2.14"
pdfmake: "npm:0.2.15"
pg: "npm:8.13.1"
rate-limiter-flexible: "npm:5.0.4"
react: "npm:18.3.1"
Expand Down Expand Up @@ -34574,6 +34575,13 @@ __metadata:
languageName: node
linkType: hard

"jpeg-exif@npm:^1.1.4":
version: 1.1.4
resolution: "jpeg-exif@npm:1.1.4"
checksum: 10/75699bd7161de1be99e847166917957bfb405ed736655361c58f0390e7182cc28999b2cbc31e650b71b6d2ad38843789439a121ac64988b2ccaa00f6832bb3d9
languageName: node
linkType: hard

"js-beautify@npm:^1.14.5":
version: 1.15.1
resolution: "js-beautify@npm:1.15.1"
Expand Down Expand Up @@ -41367,15 +41375,15 @@ __metadata:
languageName: node
linkType: hard

"pdfmake@npm:0.2.14":
version: 0.2.14
resolution: "pdfmake@npm:0.2.14"
"pdfmake@npm:0.2.15":
version: 0.2.15
resolution: "pdfmake@npm:0.2.15"
dependencies:
"@foliojs-fork/linebreak": "npm:^1.1.1"
"@foliojs-fork/pdfkit": "npm:^0.14.0"
"@foliojs-fork/linebreak": "npm:^1.1.2"
"@foliojs-fork/pdfkit": "npm:^0.15.1"
iconv-lite: "npm:^0.6.3"
xmldoc: "npm:^1.1.2"
checksum: 10/28cff311198fc464e25ff7110bc07ef5e990288fa2b3f2d1442a91d198eb2ea36d595c2a5d5c9a368c43106020c55899cb71d6bd418a5461206fab0a5768ed23
xmldoc: "npm:^1.3.0"
checksum: 10/f279f3829684857e100485cc10740806c4c0c296d531fc1aef1e0f571ec306f30e29b000eb6c514c09a340ff151528757cb215b9f8fcd0dfe601cf2ed9123c2d
languageName: node
linkType: hard

Expand Down Expand Up @@ -52404,7 +52412,7 @@ __metadata:
languageName: node
linkType: hard

"xmldoc@npm:^1.1.2":
"xmldoc@npm:^1.3.0":
version: 1.3.0
resolution: "xmldoc@npm:1.3.0"
dependencies:
Expand Down

0 comments on commit b9cb807

Please sign in to comment.