Skip to content

Issue with imports replacement #130

@sisyphusSmiling

Description

@sisyphusSmiling

Problem

Cross posting this issue here. Bug found in dependent package flow-js-testing.

Within flow-cadut, imports.replaceImportAddresses() seems to have an issue resolving import addresses.

This was not an issue before recent changes to the flow-cadut package, specifically those changes to the method in question, which leads me to believe that the issue lies with flow-cadut.

Steps to Reproduce

I'll paste how I came across this issue in the context of the dependent flow-js-testing package:

As an example, running the following in a test using flow-js-testing:

test("getAccountAddress breaks", async () => {
        const testAddress = await getAccountAddress("TestAddress");
    });

Gets us the following output:

Cannot read properties of undefined (reading 'replace')
TypeError: Cannot read properties of undefined (reading 'replace')
    at Object.replace [as replaceImportAddresses] (/Users/gsanchez/Workspace/flow-core-contracts/lib/js/test/node_modules/@onflow/flow-cadut/src/imports.js:103:15)
    at replaceImportAddresses (/Users/gsanchez/Workspace/flow-core-contracts/lib/js/test/node_modules/@onflow/flow-js-testing/src/interaction.js:95:14)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Alternatively, this can be reproduced with an existing repo - flow-nft's JS tests are no longer passing. Try pulling and running those and you should get something like the output quoted above.

Acceptance Criteria

Errors are resolved

Context

Currently blocked from writing tests for the Execution Node versioning contract

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions