Skip to content

Commit 192e1f4

Browse files
committed
Fix code coverage.
1 parent 38a9913 commit 192e1f4

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

typescript/packages/reality-capture-conversion/src/RealityConversionService.test.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ describe("Reality conversion unit tests", () => {
2929
this.timeout(30000);
3030
dotenv.config({ path: path.resolve(__dirname, "../../../../../.env") });
3131

32-
iTwinId = "c3739cf2-9da3-487b-b03d-f58c8eb97e5b";
33-
const clientId = "service-KhTIVb9k3NhIfvGf5DyBG6Lyu";
34-
const secret = "DErmHlAYXae0np1KQCtVzvCFZBoQGTjliGYqvt0zpWs6k9kqsCdigoPw1Ek3/WLi3RipJ9/M9674pMxEfc8TDw==";
32+
iTwinId = process.env.IMJS_UNIT_TESTS_PROJECT_ID ?? "";
33+
const clientId = process.env.IMJS_UNIT_TESTS_CLIENT_ID ?? "";
34+
const secret = process.env.IMJS_UNIT_TESTS_SECRET ?? "";
3535
authorizationClient = new ServiceAuthorizationClient({
3636
clientId: clientId,
3737
clientSecret: secret,
@@ -61,8 +61,9 @@ describe("Reality conversion unit tests", () => {
6161
"inputs": [{"id": "lasId"}, {"id": "lazId"}, {"id": "plyId"}, {"id": "e57Id"}],
6262
"outputs": ["OPC"],
6363
"options": {
64-
"processingEngines": 8,
65-
},
64+
"processingEngines": 8,
65+
"merge": false
66+
}
6667
}).reply(201,
6768
{
6869
"job": {
@@ -77,7 +78,8 @@ describe("Reality conversion unit tests", () => {
7778
"inputs": [{"type": "LAS", "id": "lasId"}, {"type": "LAZ", "id": "lazId"}, {"type": "PLY", "id": "plyId"}, {"type": "E57", "id": "e57Id"}],
7879
"outputs": [{"type": "OPC", "id": "OPCId"}],
7980
"options": {
80-
"processingEngines": 8
81+
"processingEngines": 8,
82+
"merge": false
8183
},
8284
}
8385
});
@@ -89,17 +91,16 @@ describe("Reality conversion unit tests", () => {
8991
rcSettings.inputs.ply = ["plyId"];
9092
rcSettings.outputs.opc = true;
9193
rcSettings.options.engines = 8;
94+
rcSettings.options.merge = false;
9295
const jobName = "Reality Conversion unit test";
93-
96+
9497
const id = realityConversionService.createJob(rcSettings, jobName, iTwinId);
9598
await sleep(2000);
9699

97100
if(axiosMock.history.post.length === 0)
98101
return expect(axiosMock.history.post.length).equal(1, "Mock adapter has not been called as expected.");
99102

100103
const body = JSON.parse(axiosMock.history.post[0].data);
101-
console.log(body);
102-
console.log(rcSettings);
103104
return Promise.all([
104105
expect(body).to.have.property("type", "Conversion"),
105106
expect(body).to.have.property("name", "Reality Conversion unit test"),
@@ -114,6 +115,7 @@ describe("Reality conversion unit tests", () => {
114115
expect(body.outputs).to.deep.include("OPC"),
115116
expect(body).to.have.property("options"),
116117
expect(body.options).to.have.property("processingEngines", 8),
118+
expect(body.options).to.have.property("merge", false),
117119
expect(id).to.eventually.deep.equal("cc3d35cc-416a-4262-9714-b359da70b419"),
118120
]);
119121
});

typescript/packages/reality-capture-conversion/src/Utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ export class RCJobSettings {
158158
if(this.options) {
159159
if(this.options.engines)
160160
json["options"]["processingEngines"] = this.options.engines;
161-
json["options"]["merge"] = this.options.engines;
161+
if(this.options.merge)
162+
json["options"]["merge"] = this.options.merge;
162163

163164
}
164165

@@ -200,7 +201,8 @@ export class RCJobSettings {
200201
if(settingsJson["options"]) {
201202
if(settingsJson["options"]["processingEngines"])
202203
newJobSettings.options.engines = settingsJson["options"]["processingEngines"];
203-
newJobSettings.options.merge = settingsJson["options"]["merge"];
204+
if(settingsJson["options"]["merge"])
205+
newJobSettings.options.merge = settingsJson["options"]["merge"];
204206
}
205207

206208
return newJobSettings;

0 commit comments

Comments
 (0)