Closed YoDaMa closed 3 years ago
CI is not working for some reason (keeps just cancelling without error), so here is the output of running the Node.js Test Suite:
resolver - node remote URL resolution simple DTDL resolution Fetching: dtmi:contoso:FakeDeviceManagement:DeviceInformation;1 √ should return a promise that resolves to a mapping from a DTMI to a JSON object depenency resolution (using pseudo-parsing) Fetching: dtmi:contoso:FakeDeviceManagement:DeviceInformation;1 √ given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object Fetching: dtmi:contoso:FakeDeviceManagement:TemperatureController;1 Fetching: dtmi:contoso:FakeDeviceManagement:Thermostat;1 Fetching: dtmi:azure:DeviceManagement:DeviceInformation;1 √ given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects try from expanded (expanded.json) Fetching: dtmi:contoso:FakeDeviceManagement:DeviceInformation;1 √ should return a promise that resolves to a mapping from a DTMI to a JSON object Fetching: dtmi:contoso:FakeDeviceManagement:DeviceInformation;1 √ given no expanded format exists for the given DTMI, should fallback to resolution with dependencies local file resolution simple DTDL resolution Fetching: dtmi:contoso:FakeDeviceManagement:thermostat;1 √ should return a promise that resolves to a mapping from a DTMI to a JSON object dependency resolution (using pseudo-parsing) Fetching: dtmi:contoso:FakeDeviceManagement:TemperatureController;1 Fetching: dtmi:contoso:FakeDeviceManagement:Thermostat;1 Fetching: dtmi:azure:DeviceManagement:DeviceInformation;1 √ given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects Fetching: dtmi:contoso:FakeDeviceManagement:thermostat;1 √ given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object try from expanded (expanded.json) Fetching: dtmi:contoso:FakeDeviceManagement:TemperatureController;1 √ should return a promise that resolves to a mapping from the DTMIs to the JSON objects Fetching: dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2 Fetching from expanded failed. Trying without. Fetching: dtmi:contoso:FakeDeviceManagement:Thermostat;1 Fetching: dtmi:azure:DeviceManagement:DeviceInformation;1 Fetching from expanded failed. Trying without. √ given no expanded format exists for the given DTMI, should fallback to resolution with dependencies (68ms)
10 passing (324ms)
including dtmiConventions tests:
dtmiConventions isValidDtmi valid √ should validate a correctly formatted dtmi (dtmi:azure:DeviceManagement:DeviceInformation;1) √ should validate a correctly formatted dtmi (dtmi:azure:DeviceManagement:DeviceInformation;10000) √ should validate a correctly formatted dtmi (dtmi:com:DeviceInformation;1) √ should validate a correctly formatted dtmi (dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1) √ should validate a correctly formatted dtmi (dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7) √ should validate a correctly formatted dtmi (dtmi:thermometer;2) invalid √ should invalidate incorrectly formatted dtmi (dtmiazure:DeviceManagement:DeviceInformation;1) √ should invalidate incorrectly formatted dtmi (dtmi;azure;DeviceManagement;DeviceInformation;1) √ should invalidate incorrectly formatted dtmi (asdf) √ should invalidate incorrectly formatted dtmi (dtmi:azure:DeviceManagement:DeviceInformation;-1) √ should invalidate incorrectly formatted dtmi (dtmi:azure:DeviceManagement:Device-Information;1) √ should invalidate incorrectly formatted dtmi (DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7) √ should invalidate incorrectly formatted dtmi (dmti:azure:thermometer;10) dtmiToPath valid √ should reformat a DTMI to a generic path (dtmi:azure:DeviceManagement:DeviceInformation;1) √ should reformat a DTMI to a generic path (dtmi:azure:DeviceManagement:DeviceInformation;10000) √ should reformat a DTMI to a generic path (dtmi:com:DeviceInformation;1) √ should reformat a DTMI to a generic path (dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1) √ should reformat a DTMI to a generic path (dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7) √ should reformat a DTMI to a generic path (dtmi:thermometer;2) invalid √ should fail if the dtmi is not formatted correctly (dtmiazure:DeviceManagement:DeviceInformation;1) √ should fail if the dtmi is not formatted correctly (dtmi;azure;DeviceManagement;DeviceInformation;1) √ should fail if the dtmi is not formatted correctly (asdf) √ should fail if the dtmi is not formatted correctly (dtmi:azure:DeviceManagement:DeviceInformation;-1) √ should fail if the dtmi is not formatted correctly (dtmi:azure:DeviceManagement:Device-Information;1) √ should fail if the dtmi is not formatted correctly (DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7) √ should fail if the dtmi is not formatted correctly (dmti:azure:thermometer;10) dtmiToFullyQualifiedPath invalid √ should fail if the dtmi is not formatted correctly (dtmiazure:DeviceManagement:DeviceInformation;1) √ should fail if the dtmi is not formatted correctly (dtmi;azure;DeviceManagement;DeviceInformation;1) √ should fail if the dtmi is not formatted correctly (asdf) √ should fail if the dtmi is not formatted correctly (dtmi:azure:DeviceManagement:DeviceInformation;-1) √ should fail if the dtmi is not formatted correctly (dtmi:azure:DeviceManagement:Device-Information;1) √ should fail if the dtmi is not formatted correctly (DTMI:AZURE:DEVICEMANAGEMENT:THERMOMETER;7) √ should fail if the dtmi is not formatted correctly (dmti:azure:thermometer;10) valid standard url √ should reformat a DTMI to a qualified path (dtmi:azure:DeviceManagement:DeviceInformation;1) √ should reformat a DTMI to a qualified path (dtmi:azure:DeviceManagement:DeviceInformation;10000) √ should reformat a DTMI to a qualified path (dtmi:com:DeviceInformation;1) √ should reformat a DTMI to a qualified path (dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1) √ should reformat a DTMI to a qualified path (dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7) √ should reformat a DTMI to a qualified path (dtmi:thermometer;2) expanded url √ should reformat a DTMI to a qualified path with expanded.json (dtmi:azure:DeviceManagement:DeviceInformation;1) √ should reformat a DTMI to a qualified path with expanded.json (dtmi:azure:DeviceManagement:DeviceInformation;10000) √ should reformat a DTMI to a qualified path with expanded.json (dtmi:com:DeviceInformation;1) √ should reformat a DTMI to a qualified path with expanded.json (dtmi:test:DeviceManagement:Foo:Bar:TestOneTwoThree;1) √ should reformat a DTMI to a qualified path with expanded.json (dtmi:AZURE:DEVICEMANAGEMENT:THERMOMETER;7) √ should reformat a DTMI to a qualified path with expanded.json (dtmi:thermometer;2)
resolver - node remote URL resolution simple DTDL resolution Fetching: dtmi:contoso:FakeDeviceManagement:DeviceInformation;1 √ should return a promise that resolves to a mapping from a DTMI to a JSON object depenency resolution (using pseudo-parsing) Fetching: dtmi:contoso:FakeDeviceManagement:DeviceInformation;1 √ given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object Fetching: dtmi:contoso:FakeDeviceManagement:TemperatureController;1 Fetching: dtmi:contoso:FakeDeviceManagement:Thermostat;1 Fetching: dtmi:azure:DeviceManagement:DeviceInformation;1 √ given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects try from expanded (expanded.json) Fetching: dtmi:contoso:FakeDeviceManagement:DeviceInformation;1 √ should return a promise that resolves to a mapping from a DTMI to a JSON object Fetching: dtmi:contoso:FakeDeviceManagement:TemperatureController;1 Fetching from expanded failed. Trying without. Fetching: dtmi:contoso:FakeDeviceManagement:TemperatureController;1 Fetching: dtmi:contoso:FakeDeviceManagement:Thermostat;1 Fetching from expanded failed. Trying without. Fetching: dtmi:contoso:FakeDeviceManagement:Thermostat;1 Fetching: dtmi:azure:DeviceManagement:DeviceInformation;1 Fetching from expanded failed. Trying without. Fetching: dtmi:azure:DeviceManagement:DeviceInformation;1 √ given no expanded format exists for the given DTMI, should fallback to resolution with dependencies local file resolution simple DTDL resolution Fetching: dtmi:contoso:FakeDeviceManagement:thermostat;1 √ should return a promise that resolves to a mapping from a DTMI to a JSON object dependency resolution (using pseudo-parsing) Fetching: dtmi:contoso:FakeDeviceManagement:TemperatureController;1 Fetching: dtmi:contoso:FakeDeviceManagement:Thermostat;1 Fetching: dtmi:azure:DeviceManagement:DeviceInformation;1 √ given a DTMI whose DTDL has dependencies, should return a promise that resolves to a mapping from DTMIs to JSON objects Fetching: dtmi:contoso:FakeDeviceManagement:thermostat;1 √ given a DTMI whose DTDL has no dependencies, should return a promise that resolves to a mapping from a DTMI to a JSON object try from expanded (expanded.json) Fetching: dtmi:contoso:FakeDeviceManagement:TemperatureController;1 √ should return a promise that resolves to a mapping from the DTMIs to the JSON objectsFetching: dtmi:contoso:FakeDeviceManagement:temperaturecontroller;2 Fetching from expanded failed. Trying without. Fetching: dtmi:contoso:FakeDeviceManagement:Thermostat;1 Fetching: dtmi:azure:DeviceManagement:DeviceInformation;1 Fetching from expanded failed. Trying without. √ given no expanded format exists for the given DTMI, should fallback to resolution with dependencies
55 passing (96ms)
We need to move this conversation in the mono repo. Let's reissue the PR there. @YoDaMa @rido-min @digimaun as FYI.
This implements the main resolver options, tryFromExpanded, and resolve dependencies.