Specification
It's time to split up the test modules for these areas, this will our test performance, and give us understanding of the test coverage of all our API behaviour:
tests/bin
tests/agent
tests/client
For tests/bin, each command can have its own test. Look at tests/bin/agent as a template for what to do. Right now all the other commands are single test modules in their own directory like tests/bin/identities/identities.test.ts. These should all be split up into individual commands. Note that most of the tests should be using the shared global agent. However some tests may be independent. This is where you can use the nested describe pattern as demonstrated in tests/bin/agent/status.test.ts.
Some tips:
- Use the global shared agent
- Use module mocking for prompting
- Use the correct
pkExec, pkStdio, pkSpawn, pkExpect utility
- Use 1 nested describe at the bottom in case there is a need to use a the global shared agent and also have independent tests
- Make sure to revert all side effects in the global shared agent! In every test!
We may optimise it further when realising that some tests can just use their own agent instead of sharing the agent. This is because by using the global keypair, starting agents is really fast now. This will probably need to be used in the nodes commands anyway.
For tests/agent and tests/client, this is about the GRPC API. We have now split up each RPC handler into their own file, this allows much more isolated and specific unit testing of each handler. Refer to tests/client/service/agentStop.test.ts as the template for each handler test. All rpc*.test.ts should be converted appropriately. Refer to #249 when you have questions or discussions about API design. This is just about splitting the tests up, however we may find we can fix things up regarding the API as this issue is tackled.
Additional context
Tasks
- Split up
tests/bin
- Split up
tests/client/service and refer to src/client/service and tests/client/service/agentStop.test.ts
- Split up
tests/agent/service and refer to src/agent/service
- Check for other API conformance/design issues, such as error handling.
Specification
It's time to split up the test modules for these areas, this will our test performance, and give us understanding of the test coverage of all our API behaviour:
tests/bintests/agenttests/clientFor
tests/bin, each command can have its own test. Look attests/bin/agentas a template for what to do. Right now all the other commands are single test modules in their own directory liketests/bin/identities/identities.test.ts. These should all be split up into individual commands. Note that most of the tests should be using the shared global agent. However some tests may be independent. This is where you can use the nested describe pattern as demonstrated intests/bin/agent/status.test.ts.Some tips:
pkExec,pkStdio,pkSpawn,pkExpectutilityWe may optimise it further when realising that some tests can just use their own agent instead of sharing the agent. This is because by using the global keypair, starting agents is really fast now. This will probably need to be used in the nodes commands anyway.
For
tests/agentandtests/client, this is about the GRPC API. We have now split up each RPC handler into their own file, this allows much more isolated and specific unit testing of each handler. Refer totests/client/service/agentStop.test.tsas the template for each handler test. Allrpc*.test.tsshould be converted appropriately. Refer to #249 when you have questions or discussions about API design. This is just about splitting the tests up, however we may find we can fix things up regarding the API as this issue is tackled.Additional context
tests/#306 - Node claims tests are still broken and need to be fixedTasks
tests/bintests/client/serviceand refer tosrc/client/serviceandtests/client/service/agentStop.test.tstests/agent/serviceand refer tosrc/agent/service