Hello everyone. I'm a kinda smart developer but from an absolutely different domain. And I never code TypeScript before.
Right now I'm adding new YandexDisk sync target for Joplin. And I'm facing some issues related to test. I have no idea how to properly test my new sync target.
I'm looking now at packages/lib/testing/test-utils.ts
Looks like this code could test different file storage providers.
But only one provider is hard-coded to be ON setSyncTargetName('memory');
The question is how to run this code for a custom cloud provider like a OneDrive ?
what is the cli command to execute only this test ?
in what directory I should put credentials file like onedrive-auth.txt ?
"memory" is the sync target we use by default for test units because it's faster, but as you can see there are other supported sync targets there, but currently commented out:
So to test you'd replace the memory one with eg setSyncTargetName('yandex')
Then under initFileApi() still in test-utils.ts you can add sync target specific initialisation code. The files like onedrive-auth.txt go in ~/joplin-credentials. You can create one for Yandex if needed and access it with, for example, await credentialFile('yandex-auth.txt')
test-utils as the name says are just utils used by other tests. If you only want to run sync related tests I think running yarn test synchronize would do that. Try also yarn test to be sure all tests are included because some make use of the active sync target even though they don't have "synchronize" in the name.