Code Monkey home page Code Monkey logo

Comments (2)

C-o-d-e-C-o-w-b-o-y avatar C-o-d-e-C-o-w-b-o-y commented on May 18, 2024 4

For others encountering this issue, it is an issue with jest: jestjs/jest#4422

The jest issue causes buffer instanceof Uint8Array to be false, which is the issue OP is having.

I was able to workaround this issue by placing the following code into my jest setup script (jest.setup.js) (defined in setupFilesAfterEnv in jest config)

const originalHasInstance = Uint8Array[Symbol.hasInstance];
Object.defineProperty(Uint8Array, Symbol.hasInstance, {
  value(potentialInstance) {
    return (
      originalHasInstance.call(this, potentialInstance) ||
      Buffer.isBuffer(potentialInstance)
    );
  },
});

This extends the instanceof logic of Uint8Array to additionally check if the object is a buffer, and if so, instanceof Uint8Array will return true.

Hope it helps!

from solana-pay.

jordaaash avatar jordaaash commented on May 18, 2024

Hmm I can't really tell what's going on, but this sounds like an issue with the new test rather than the createTransfer function itself. I would suggest opening a PR from your branch to the link-request branch and we can comment on that PR instead of an issue since this doesn't affect the master branch.

Looking at your code, I'm guessing the issue is related to this line? https://github.com/tyirenkyi/solana-pay/blob/7a935665ee5c91fd8e6aca5582eb10a300d4ba21/core/test/createTransfer.test.ts#L11

from solana-pay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.