Skip to content

Commit

Permalink
Stub crypto for older nodejs
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba-orlik committed Jul 4, 2024
1 parent 150bc14 commit 1466197
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { handler } from './index'
import { MCEvent } from '@managed-components/types'

import crypto from 'crypto'
if (!global.crypto) {
vi.stubGlobal('crypto', crypto)
}

describe('custom-html', () => {
it('executes html injection', () => {
const executedJS: string[] = []
Expand All @@ -26,7 +31,6 @@ describe('custom-html', () => {
},
}
handler(fakeEvent)
console.log({ executedJS })
expect(executedJS).toHaveLength(3)
expect(executedJS[0]).toEqual(
"const d = document.createElement('div');d.innerHTML = `<p>some text</p>\n" +
Expand Down

0 comments on commit 1466197

Please sign in to comment.