score:1

When using React this works for me:

describe("your test suite", () => {
  const originalGetComputedTextLength =
    SVGElement.prototype.getComputedTextLength
  beforeEach(
    () =>
      (SVGElement.prototype.getComputedTextLength = () => {
        return 150
      })
  )
  afterEach(
    () =>
      (SVGElement.prototype.getComputedTextLength = originalGetComputedTextLength)
  )

  it("your test case", async () => {
    ...


Related Query

More Query from same tag