Commit 872251ad authored by Philip Paetz's avatar Philip Paetz Committed by chapati

chore: updated a few error- and success-messages for `encrypt`, `decrypt`, and `validate` commands

parent cf316a67
......@@ -150,7 +150,9 @@ describe('strong-config decrypt', () => {
it('informs user about the decryption result', async () => {
await Decrypt.run([configPath])
expect(mockedSuceedSpinner).toHaveBeenCalledWith('Decrypted!')
expect(mockedSuceedSpinner).toHaveBeenCalledWith(
`Successfully decrypted ${configPath}!`
)
})
it('informs user about decryption errors', async () => {
......
......@@ -37,7 +37,8 @@ export default class Decrypt extends Command {
static args = [
{
name: 'config_path',
description: 'path to an encrypted config file',
description:
'path to a decrypted config file, for example: `strong-config encrypt ./config/production.yml`',
required: true,
},
{
......@@ -92,8 +93,12 @@ const decrypt = (
getVerbosityLevel(flags.verbose)
)
if (error.exitCode === 1) {
console.log(`🤔 It looks like ${args.config_path} is already decrypted`)
}
process.exit(1)
}
succeedSpinner('Decrypted!')
succeedSpinner(`Successfully decrypted ${args.config_path}!`)
}
......@@ -177,7 +177,9 @@ describe('strong-config encrypt', () => {
it('informs user about the encryption result', async () => {
await Encrypt.run([configPath, ...requiredKeyFlags])
expect(mockedSuceedSpinner).toHaveBeenCalledWith('Encrypted!')
expect(mockedSuceedSpinner).toHaveBeenCalledWith(
`Successfully encrypted ${configPath}!`
)
})
it('informs user about encryption errors', async () => {
......
......@@ -67,7 +67,8 @@ export default class Encrypt extends Command {
static args = [
{
name: 'config_path',
description: 'path to an unencrypted config file',
description:
'path to an unencrypted config file, for example: `strong-config encrypt ./config/production.yml`',
required: true,
},
{
......@@ -122,8 +123,12 @@ const encrypt = (
getVerbosityLevel(flags.verbose)
)
if (error.exitCode === 203) {
console.log(`🤔 It looks like ${args.config_path} is already encrypted`)
}
process.exit(1)
}
succeedSpinner('Encrypted!')
succeedSpinner(`Successfully encrypted ${args.config_path}!`)
}
......@@ -120,7 +120,7 @@ describe('strong-config validate', () => {
it('informs user about the validation result', async () => {
await Validate.run([configPath, schemaPath])
expect(mockedSuceedSpinner).toHaveBeenCalledWith('Validated!')
expect(mockedSuceedSpinner).toHaveBeenCalledWith('Config is valid!')
})
it('informs user about validation errors', async () => {
......
......@@ -32,12 +32,14 @@ export default class Validate extends Command {
static args = [
{
name: 'config_path',
description: 'path to an unencrypted config file',
description:
'path to an unencrypted config file, for example `strong-config validate config/production.yml config/schema.json`',
required: true,
},
{
name: 'schema_path',
description: 'path to a schema file',
description:
'path to a schema file, for example `strong-config validate config/production.yml config/schema.json`',
required: true,
},
]
......@@ -81,5 +83,5 @@ export const validate = (
process.exit(1)
}
succeedSpinner('Validated!')
succeedSpinner('Config is valid!')
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment