Example icon indicating copy to clipboard operation
Example copied to clipboard

Client (on server) tests for example interface

Open leonpolak opened this issue 2 years ago • 3 comments

I'm not sure how to test Metacom class in Client.js in Metacom package, for now, I have chosen to test the application code alongside to Example server. However, there are some problems:

  1. No redis in lib inside application code (service is up and running)
  2. remoteMethod.js and webHook.js seem incomplete (at least I don't understand how I should run them)
  3. No lib.resmon, so no system info no subscription tests (yes, it's Windows, but at least some fallback strategy would be nice)
  4. I need some help with uploadFile method testing, like an example of uploading and confirming success.
  5. I'd like an example of event subscription test.

leonpolak avatar Dec 26 '22 12:12 leonpolak

Subscription:

api.example.on('resmon', (data) => {
  console.log({ data });
});

tshemsedinov avatar Jan 07 '23 09:01 tshemsedinov

I have tried a lot of approaches to make tests in test/client.js work (those attempts are partially commented out in the code), but it seems there are significant problems with metacom/lib/client.js

  1. There is still no redis in lib on server
  2. httpCall returns index.html to any POST request to /api
  3. So, there is no way to test uploading
  4. I still have no clear understanding how to test subscription Any help would be greatly appreciated, it's a bit of an obstacle to my further development.

leonpolak avatar Mar 02 '23 18:03 leonpolak

I took all updates and changed test/client.js accordingly. There are still some problems, old and new:

  1. HttpTransport does not work:
Error: Request timeout
    at Timeout._onTimeout (C:\usr\sites\metarhia\Example\node_modules\metacom\lib\client.js:181:22)
  1. No "accountId" field from rpc example/getClientInfo
  2. There is still no redis in lib on server
TypeError: Cannot read properties of undefined (reading 'set')
  method (\application\api\example.1\redisSet.js:4:36)

leonpolak avatar Mar 15 '23 10:03 leonpolak