Repository: elastic/synthetics
Pull request #346 (2021-07-13 15:33:15)

fix: default to name for journey id
+ Id and Name are always required for the monitor to show correctly in the Uptime UI. 

apmmachine: 
## :green_heart: Build Succeeded


<!-- BUILD BADGES-->
> _the below badges are clickable and redirect to their specific view in the CI or DOCS_
[![Pipeline View](https://img.shields.io/badge/pipeline-pipeline%20-green)](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-rum%2Felastic-synthetics%2FPR-346/detail/PR-346/1//pipeline) [![Test View](https://img.shields.io/badge/test-test-green)](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-rum%2Felastic-synthetics%2FPR-346/detail/PR-346/1//tests) [![Changes](https://img.shields.io/badge/changes-changes-green)](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-rum%2Felastic-synthetics%2FPR-346/detail/PR-346/1//changes) [![Artifacts](https://img.shields.io/badge/artifacts-artifacts-yellow)](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-rum%2Felastic-synthetics%2FPR-346/detail/PR-346/1//artifacts) [![preview](https://img.shields.io/badge/docs-preview-yellowgreen)](http://synthetics_346.docs-preview.app.elstc.co/diff)  [![preview](https://img.shields.io/badge/elastic-observability-blue)](https://ci-stats.elastic.co/app/apm/services/apm-ci/transactions/view?rangeFrom=2021-07-13T15:23:30.771Z&rangeTo=2021-07-13T15:43:30.771Z&transactionName=apm-agent-rum/elastic-synthetics/PR-{number}&transactionType=unknown&latencyAggregationType=avg&traceId=bf6ab43b478f6538e01ce73974c725cb&transactionId=f729ccfd8a059b48)

<!-- BUILD SUMMARY-->
<details><summary>Expand to view the summary</summary>
<p>

#### Build stats




* Start Time: 2021-07-13T15:33:30.771+0000


* Duration: 14 min 42 sec


* Commit: cf0e58ddad60212156c09536634b8308fe828c38



#### Test stats :test_tube:

| Test         | Results                         |
| ------------ | :-----------------------------: |
| Failed       | 0  |
| Passed       | 120  |
| Skipped      | 0 |
| Total        | 120   |


#### Trends :test_tube:


![Image of Build Times](https://apm-ci.elastic.co/job/apm-agent-rum/job/elastic-synthetics/job/PR-346/buildTimeGraph/png)


![Image of Tests](https://apm-ci.elastic.co/job/apm-agent-rum/job/elastic-synthetics/job/PR-346/1/testReport/history/countGraph/png?start=0&amp;end=25)


</p>
</details>

<!-- TEST RESULTS IF ANY-->


<!-- STEPS ERRORS IF ANY -->












<!--COMMENT_GENERATED_WITH_ID_comment.id-->

Patch:
diff --git a/.nvmrc b/.nvmrc
index ce122aa..5a80a7e 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1,1 +1,1 @@
-12.18.4
+12.22.3
diff --git a/src/core/index.ts b/src/core/index.ts
index 46d1e1f..2a5be46 100644
--- a/src/core/index.ts
+++ b/src/core/index.ts
@@ -43,7 +43,7 @@ export const journey = (
   options: JourneyOptions | string,
   callback: JourneyCallback
 ) => {
-  log(`register journey: ${options}`);
+  log(`register journey: ${JSON.stringify(options)}`);
   if (typeof options === 'string') {
     options = { name: options, id: options };
   }
diff --git a/src/dsl/journey.ts b/src/dsl/journey.ts
index b613731..2bdc55a 100644
--- a/src/dsl/journey.ts
+++ b/src/dsl/journey.ts
@@ -54,7 +54,7 @@ export class Journey {
 
   constructor(options: JourneyOptions, callback: JourneyCallback) {
     this.name = options.name;
-    this.id = options.id;
+    this.id = options.id || options.name;
     this.tags = options.tags;
     this.callback = callback;
   }


Test patch:
diff --git a/__tests__/dsl/journey.test.ts b/__tests__/dsl/journey.test.ts
index 1905027..e76bbae 100644
--- a/__tests__/dsl/journey.test.ts
+++ b/__tests__/dsl/journey.test.ts
@@ -27,6 +27,15 @@ import { Journey, Step } from '../../src/dsl';
 
 const noop = () => {};
 describe('Journey', () => {
+  it('add journey details', () => {
+    const name = 'j1';
+    const tags = ['foo', 'bar'];
+    const journey = new Journey({ name, tags }, noop);
+    expect(journey.name).toEqual(name);
+    expect(journey.id).toBe(name);
+    expect(journey.tags).toEqual(tags);
+  });
+
   it('add step to the journey', () => {
     const journey = new Journey({ name: 'j1' }, noop);
     journey.addStep('s1', noop);