Closed manujuniris closed 2 years ago
Your unit test implementation is not in the right direction. You have rewritten functions in your unit tests, but they should call your existing functions and assert a behavior. So your code implementation should match with the expectations provided in the tests.
Also regarding networking calls, you should use mocks to simulate the response from a server, otherwise in a automatic testing (CI) this will not work.
Your unit test implementation is not in the right direction. You have rewritten functions in your unit tests, but they should call your existing functions and assert a behavior. So your code implementation should match with the expectations provided in the tests.
Also regarding networking calls, you should use mocks to simulate the response from a server, otherwise in a automatic testing (CI) this will not work.
ok got it
I don't see any assertions here? Is this purposely written?
Something like expecting a
console.log
message with success text after deployments. or some other way that guarantees the function worked well...I found a lib to use test console for expecting console messages and so...
I'm getting timeout error, also const output = await new Promise((resolve) => { parser.parse("deploy-file --seed=myseed --endpoint=http://localhost:4000 --file=./aeweb.js", (err, argv, output) => { resolve(output); })
});
output is null here in this case, when I try console.log(output) , the result is null
I suggest to leverage nock
to mock the http calls to the archethic node.
So you could test with scenario without a ceremony to setup infrastructure for testing.
Description
This PR is created to add unit tests to the project.
The following output was captured -