scottdurow / dataverse-ify

Easily call the Dataverse WebApi from TypeScript using SDK style types, with a NodeJS implementation for integration testing.
MIT License
59 stars 16 forks source link

nodewebapi error when running integration tests #15

Closed oliver-chadwick closed 2 years ago

oliver-chadwick commented 3 years ago

Hi,

I'm trying to use the dataverse-ify functionality to set up some integration tests. When I attempt to run npm test integration to begin executing the tests, it fails with the error:

`Configuration property "nodewebapi" is not defined

  12 |   beforeEach(async () => {
  13 |     XrmMockGenerator.initialise();
> 14 |     await SetupGlobalContext();
     |           ^
  15 |     setMetadataCache(metadataCache);
  16 |     Xrm.Utility.showProgressIndicator = jest.fn();
  17 |     Xrm.Utility.closeProgressIndicator = jest.fn();

  at Config.Object.<anonymous>.Config.get (../../../../Users/olive/AppData/Roaming/npm/node_modules/dataverse-ify/node_modules/config/lib/config.js:182:11)`

I can see the nodewebai property in my test.yaml file and it is null but the instructions seem to suggest thats correct?

I've also noticed (not sure if related or not, but in the dataverse-ify module from npm, an compile time error is being returned around the XrmStatic.ts class, stating:

{ "resource": "/c:/Dynamics/Training/dev1_tsjs/clientjs/node_modules/dataverse-ify/src/webapi/XrmStatic.ts", "owner": "typescript", "code": "2739", "severity": 8, "message": "Type 'NodeXrmUtilityStatic' is missing the following properties from type 'Utility': getLearningPathAttributeName, getPageContext", "source": "ts", "startLineNumber": 22, "startColumn": 7, "endLineNumber": 22, "endColumn": 36 }

Thanks Oli

scottdurow commented 3 years ago

Thanks @oliver-chadwick - could you create a small repro project that shows this issue please so I can track down the cause. Thank you!

oliver-chadwick commented 3 years ago

Hi @scottdurow - I've attached a copy repro here that shows the issue.

ConfigErrorRepo.zip

Thanks

scottdurow commented 2 years ago

Hi @oliver-chadwick - you probably have solved this but the issue is caused by your test.yam not being indented correcty. Yours is:

nodewebapi: 
server: 
host: https://org.crm4.dynamics.com
version: 9.1

it should be:

nodewebapi:
 server:
  host: https://org.api.crm3.dynamics.com/
  version: 9.1

notice the indentication of server, and host/version.

The compile issue you are seeing from XrmStatic is likely if you are importing the source of XrmStatic but using a later version of @types/xrm to the one it was compiled against.

I'll close this for now - please re-open if you have further questions.