-
Couldn't load subscription status.
- Fork 570
test: add integration test to test generated TS client #2446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The package uses Vitest [https://vitest.dev] to run test written in typescript.
This function allows running typescript tests as part of an integration tests agains an scaffolded chain.
|
Are these tests for the current or the new client? We might not want to invest in testing Vuex, because it is on its way out. |
The tests are for the typescript client related code, but is true that right now it can be misleading as we have to run @ilgooz should we wait for the Vue / TS client refactor PR to be finished ? I am not sure if otherwise we would need a small refactor for the tests, I am thinking we might. |
|
This PR is about preparing the environment for testing the generated JS code. There is also one test to test the generic client (generic client's API won't be changed by the refactor), rest of the tests including for the ones related to Vuex should be added by @ignite-hq/web. We don't need to wait code generation refactoring to be finished to merge this PR, they're not relevant. |
This fixes the client tests that were giving a timeout because the chain was not running.
This change proposes a way to organize TS client related integration tests. The idea is to have the Go and TS files at the same level to make their relation obvious, instead of having the TS tests inside a sub testdata dir which hides it.
The packages for the user modules can be imported in the TS client integration tests with this change
|
@jeronimoalbi I merged develop and surprisingly the tests are working, maybe it's not working on my machine because of the npm version... $ npm version
{
npm: '8.18.0',
node: '18.7.0',
v8: '10.2.154.13-node.9',
uv: '1.43.0',
zlib: '1.2.12',
brotli: '1.0.9',
ares: '1.18.1',
modules: '108',
nghttp2: '1.48.0',
napi: '8',
llhttp: '6.0.7',
openssl: '1.1.1q',
cldr: '41.0',
icu: '71.1',
tz: '2022a',
unicode: '14.0'
} |
|
@jeronimoalbi on my machine, the cosmosgen tests are failing with this error : Any hint ? |
Actually no, I will run it locally to see if I can figure it out but I would recommend to wait until #2143 is merged, which should happen soon, before working on this branch because it needs some changes to get fully up to date. Once the related PR is merged I will work on this to bring it up to date. |
db3b77d to
b3a9043
Compare
* feat: add integration env function to update config.yml * feat: add integration env function to install Vue boilerplate deps * feat: add tstestrunner package to integration tests The package uses Vitest [https://vitest.dev] to run test written in typescript. * feat: add integration env function to run typescript tests This function allows running typescript tests as part of an integration tests agains an scaffolded chain. * ci: exclude "testdata" dir from the integration tests run * feat: add fetch API support to TS client tests * chore: rename InstallClientDep to InstallClientVueDeps * test: add integration TS client test to perform a transfer * fix: change bank client test to serve chain in gopher and wait This fixes the client tests that were giving a timeout because the chain was not running. * refactor: add tsclient dir to group TS client tests with Go test files This change proposes a way to organize TS client related integration tests. The idea is to have the Go and TS files at the same level to make their relation obvious, instead of having the TS tests inside a sub testdata dir which hides it. * refactor: remove InstallClientVueDeps to simplify env API * refactor: move tstestrunner package into tsclient's testdata dir * refactor: move TS bank tests to a separate folder * refactor: move tsclient bank module test to cosmosgen dir * refactor: move testdata/tstestrunner to integration dir * feat: change TS tests to discover user generated module packages The packages for the user modules can be imported in the TS client integration tests with this change * refactor: change TS test runner to init global values This allows the removal of repeated test code into the test runner domain. * feat: change test env to allow choosing the TS client test file The option allows to look for tests inside a single test file, otherwise it would happen that all test files are checked. * refactor: change bank module test to send accounts to TS tests * chore: remove ClientTestDir option for the integration tests The option is now useless because all the tests must live inside the "integration" dir and the relative path to a test file can be assigned using the ClientTestFile option. * chore: change names for consistency * refactor: add "testutil" folder to organize tstestrunner code * fix: import paths for bank module integration test * refactor: moved client integration support to a separate file * chore: update changelog * chore: remove unused ts-client generation command flag * refactor: change RunClientTests to match latest changes * refactor: change integration TS testrunner for the latest changes * refactor: change bank TS module test to work with latest changes * fix: remove `--proto-all-modules` from TS client integration test * chore: changed `global` TS variable to `globalThis` Co-authored-by: Alex Johnson <alex@shmeeload.xyz>
Closes #2382