Skip to content

Commit

Permalink
Merge pull request #2000 from sarahkitten/main
Browse files Browse the repository at this point in the history
Return quickstart keywords as empty array if no keywords are provided
  • Loading branch information
Andrew Anguiano authored Sep 5, 2023
2 parents bb8038e + 8523693 commit dd96936
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
1 change: 0 additions & 1 deletion quickstarts/gatsby-build/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ documentation:
description: |
Ship performance data from Gatsby builds using OpenTelemetry
url: https://newrelic.com/blog/best-practices/optimize-gatsby-build-opentelemetry

dashboards:
- gatsby-build
4 changes: 3 additions & 1 deletion utils/__tests__/dashboard-helper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ describe('dashboard-helper', () => {
test('finds warnings across multiple lines', () => {
const multiLine = {
"accountIds": [
12345678
12345678,
3456,
12,
],
}
expect(getWarnings(multiLine)).toHaveLength(1);
Expand Down
2 changes: 1 addition & 1 deletion utils/lib/Quickstart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class Quickstart {
description: doc.description,
})),
icon: icon && this._constructIconUrl(icon),
keywords: keywords,
keywords: keywords ?? [],
sourceUrl: Component.getAssetSourceUrl(
Component.removeBasePath(path.dirname(this.configPath), this.basePath)
),
Expand Down
12 changes: 11 additions & 1 deletion utils/lib/__tests__/Quickstart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ describe('Quickstart', () => {
expect(variables.quickstartMetadata.installPlanStepIds).toHaveLength(1);
expect(variables.quickstartMetadata.dataSourceIds).toHaveLength(1);
});

test('Returns keywords as empty array if no keywords are provided', async () => {
const qs = new Quickstart(
'quickstarts/mock-quickstart-11/config.yml',
MOCK_FILES_BASEPATH
);
const variables = await qs.getMutationVariables(true);

expect(variables.quickstartMetadata.keywords).toEqual([]);
});
});

describe('validate', () => {
Expand Down Expand Up @@ -187,7 +197,7 @@ describe('Quickstart', () => {
test('Returns all quickstarts in directory', () => {
const quickstarts = Quickstart.getAll(MOCK_FILES_BASEPATH);

expect(quickstarts).toHaveLength(10);
expect(quickstarts).toHaveLength(11);
});

test('Handles no quickstarts in directory', () => {
Expand Down
39 changes: 39 additions & 0 deletions utils/mock_files/quickstarts/mock-quickstart-11/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Name of the quickstart (required)
slug: template-quickstart

# Displayed in the UI (required)
title: Template Quickstart

# Long-form description of the quickstart (required)
description: |
The template quickstart allows you to get visibility into the performance and available of your example service and dependencies. Use this quickstart together with the mock up integrations.
# Displayed in search results and recommendations. Summarizes a quickstarts functionality.
summary: |
A short form description for this quickstart
# Support level: New Relic | Verified | Community (required)
level: Community

# Authors of the quickstart (required)
authors:
- John Smith

# No keywords

# Reference to install plans located under /install directory
# Allows us to construct reusable "install plans" and just use their ID in the quickstart config
installPlans:
- mock-install-1

dataSourceIds:
- test-data-source

documentation:
- name: Installation Docs
url: docs.newrelic.com
description: Description about this doc reference

# Content / Design
icon: logo.png
website: https://www.newrelic.com

0 comments on commit dd96936

Please sign in to comment.