From 04ff56f6b167ab6c400355e3e215c883a4004b44 Mon Sep 17 00:00:00 2001 From: Mike Stemle Date: Sun, 4 Aug 2024 16:24:40 -0400 Subject: [PATCH] Checkpoint --- __tests__/data/component-mappings-complete.yaml | 14 ++++++++++++++ __tests__/lib/component-mappings.test.cjs | 5 +++++ lib/component-mappings.cjs | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 __tests__/data/component-mappings-complete.yaml diff --git a/__tests__/data/component-mappings-complete.yaml b/__tests__/data/component-mappings-complete.yaml new file mode 100644 index 0000000..eb6b222 --- /dev/null +++ b/__tests__/data/component-mappings-complete.yaml @@ -0,0 +1,14 @@ +- name: PHP Web App + kind: service + repo: https://github.com/fake+org/php-web-app + languages: | + - php + - sql + - javascript + tags: | + - internet_accessible:true +- name: MySQL Database + kind: datastore + repo: https://github.com/fake+org/database-ddl + slack-support-channel: 'https://fakeorg.slack.com/archives/A0000000008' + languages: sql diff --git a/__tests__/lib/component-mappings.test.cjs b/__tests__/lib/component-mappings.test.cjs index b60a674..eca9815 100644 --- a/__tests__/lib/component-mappings.test.cjs +++ b/__tests__/lib/component-mappings.test.cjs @@ -1,3 +1,5 @@ +const YAML = require('yaml') +const core = require('@actions/core') const subject = require('../../lib/component-mappings.cjs') describe('imports', () => { @@ -17,7 +19,10 @@ describe('imports', () => { describe('component metadata', () => { // Let's test the entity types test('#mapComponentMetadata()', () => { + // Empty works expect(subject._test.mapComponentMetadata()) + + const }) }) diff --git a/lib/component-mappings.cjs b/lib/component-mappings.cjs index cf95acb..f5b4b39 100644 --- a/lib/component-mappings.cjs +++ b/lib/component-mappings.cjs @@ -11,7 +11,9 @@ const mapComponentMetadata = (core, componentObject = {}) => { id: componentObject?.id, inheritFrom: componentObject?.inheritFrom, owner: { name: componentObject?.owner ?? componentObject?.team }, - additionalOwners: component?.additionalOwners?.map((x) => ({ name: x })), + additionalOwners: componentObject?.additionalOwners?.map((x) => ({ + name: x, + })), name: componentObject?.name, namespace: componentObject?.namespace, description: componentObject?.description,