Skip to content

Commit

Permalink
Change flattenJSONObject to return POSIX compliant names
Browse files Browse the repository at this point in the history
  • Loading branch information
cbui committed Jul 21, 2021
1 parent 68d18fb commit 675c52d
Show file tree
Hide file tree
Showing 4 changed files with 7,211 additions and 11 deletions.
7 changes: 4 additions & 3 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getSecretValue, listSecrets, getSecretValueMap, getSecretNamesToFetch } from '../src/index'
import * as core from '@actions/core'
import { getSecretValue, listSecrets, getSecretValueMap, getSecretNamesToFetch, injectSecretValueMapToEnvironment } from '../src/index'
import { getPOSIXString } from '../src/utils'
import { SecretsManager } from 'aws-sdk'
import { Inputs } from '../src/constants'
Expand Down Expand Up @@ -59,7 +60,7 @@ test('Get Secret Value Map: parse=false, plain-text value', () => {
test('Get Secret Value Map: parse=true, JSON string value', () => {
expect.assertions(1)
return getSecretValueMap(secretsManagerClient, 'my_secret_2', true).then(secretValueMap => {
expect(secretValueMap).toMatchObject({ 'my_secret_2.foo': 'bar' })
expect(secretValueMap).toMatchObject({ 'my_secret_2_foo': 'bar' })
})
})

Expand All @@ -73,7 +74,7 @@ test('Get Secret Value Map: parse=false, JSON string value', () => {
test('Get Secret Value Map: parse=true, Base64 encoded JSON string value', () => {
expect.assertions(1)
return getSecretValueMap(secretsManagerClient, 'my/secret/3', true).then(secretValueMap => {
expect(secretValueMap).toMatchObject({ 'my/secret/3.foo': 'bar' })
expect(secretValueMap).toMatchObject({ 'my/secret/3_foo': 'bar' })
})
})

Expand Down
2 changes: 1 addition & 1 deletion __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('Valid JSON object', () => {
})

test('Valid JSON object string test', () => {
expect(flattenJSONObject({"foo": {"bar": "baz"}})).toMatchObject({"foo.bar": "baz"})
expect(flattenJSONObject({"foo": {"bar": "baz"}})).toMatchObject({"foo_bar": "baz"})
})

test('FilterBy test', () => {
Expand Down
Loading

0 comments on commit 675c52d

Please sign in to comment.