Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
chore: add test for isBinary explicitly set to false
Browse files Browse the repository at this point in the history
  • Loading branch information
ninadpage committed Dec 22, 2020
1 parent fccf502 commit 9b2511b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/backends/kv-backend.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ describe('kv-backend', () => {
kvBackend._get.onCall(0).resolves(Buffer.from('YmluYXJ5Cg==', 'base64')) // base64 of binary as a Buffer
kvBackend._get.onCall(1).resolves(Buffer.from('YmluYXJ5Cg==', 'base64')) // base64 of binary as a Buffer
kvBackend._get.onCall(2).resolves('YmluYXJ5Cg==') // base64 of binary as String
kvBackend._get.onCall(3).resolves('test') // base64 of binary as String
// e.g. AWS Secrets Manager will return `SecretBinary` as a Buffer and `SecretString` as a String

const manifestData = await kvBackend.getSecretManifestData({
Expand All @@ -508,14 +509,19 @@ describe('kv-backend', () => {
// isBinary: false,
// must be set to true to ensure base64-encoded string in the backend
// is not encoded in base64 again
}, {
key: 'stringPropertyKey4',
name: 'stringPropertyName4',
isBinary: false // explicitly set false
}]
}
})

expect(manifestData).deep.equals({
binaryPropertyName1: 'YmluYXJ5Cg==', // base64 of binary (unchanged)
binaryPropertyName2: 'YmluYXJ5Cg==', // base64 of binary (unchanged)
stringPropertyName3: 'WW1sdVlYSjVDZz09' // base64 of base64 of binary
stringPropertyName3: 'WW1sdVlYSjVDZz09', // base64 of base64 of binary
stringPropertyName4: 'dGVzdA==' // base64 of test
})
})
})
Expand Down

0 comments on commit 9b2511b

Please sign in to comment.