@aws-amplify/amplify-prompts
Advanced tools
Comparing version 2.8.1-rds.0 to 2.8.1
@@ -6,3 +6,3 @@ # Change Log | ||
## [2.8.1-rds.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-prompts@2.8.0...@aws-amplify/amplify-prompts@2.8.1-rds.0) (2023-08-08) | ||
## [2.8.1](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/amplify-prompts@2.8.0...@aws-amplify/amplify-prompts@2.8.1) (2023-08-09) | ||
@@ -9,0 +9,0 @@ **Note:** Version bump only for package @aws-amplify/amplify-prompts |
{ | ||
"name": "@aws-amplify/amplify-prompts", | ||
"version": "2.8.1-rds.0", | ||
"version": "2.8.1", | ||
"description": "Utility functions for Amplify CLI terminal I/O", | ||
@@ -67,3 +67,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "fc72c0617e3211ac944462ed5747ae5d1f38e257" | ||
"gitHead": "de71c6a620878c77785331549e1478f22fad03d1" | ||
} |
@@ -98,3 +98,3 @@ import { prompt } from 'enquirer'; | ||
promptMock.mockResolvedValueOnce({ result: promptResponse }); | ||
expect(await prompter.input('test message', { transform: () => transformedValue })).toEqual(transformedValue); | ||
expect(await prompter.input('test message', { transform: (_) => transformedValue })).toEqual(transformedValue); | ||
}); | ||
@@ -101,0 +101,0 @@ |
@@ -7,3 +7,3 @@ import { Stopwatch } from '../stopwatch'; | ||
stopwatch.start(); | ||
await new Promise((resolve) => { | ||
await new Promise((resolve, __reject) => { | ||
setTimeout(resolve, 300); | ||
@@ -15,3 +15,3 @@ }); | ||
stopwatch.start(); | ||
await new Promise((resolve) => { | ||
await new Promise((resolve, __reject) => { | ||
setTimeout(resolve, 300); | ||
@@ -18,0 +18,0 @@ }); |
@@ -69,13 +69,15 @@ import { alphanumeric, and, integer, maxLength, minLength, not, or, matchRegex } from '../validators'; | ||
it('returns true if all validators return true', async () => { | ||
expect(await and([() => true, () => true])('anything')).toBe(true); | ||
expect(await and([(input) => true, (input) => true])('anything')).toBe(true); | ||
}); | ||
it('returns first error message', async () => { | ||
expect(await and([() => true, () => 'first error', () => 'second error'])('anything')).toMatchInlineSnapshot(`"first error"`); | ||
expect(await and([(input) => true, (input) => 'first error', (input) => 'second error'])('anything')).toMatchInlineSnapshot( | ||
`"first error"`, | ||
); | ||
}); | ||
it('returns override message if any validators return error message', async () => { | ||
expect(await and([() => true, () => 'first error', () => 'second error'], 'custom error message')('anything')).toMatchInlineSnapshot( | ||
`"custom error message"`, | ||
); | ||
expect( | ||
await and([(input) => true, (input) => 'first error', (input) => 'second error'], 'custom error message')('anything'), | ||
).toMatchInlineSnapshot(`"custom error message"`); | ||
}); | ||
@@ -86,11 +88,13 @@ }); | ||
it('returns true if one validator returns true', async () => { | ||
expect(await or([() => 'first error', () => true])('anything')).toBe(true); | ||
expect(await or([(input) => 'first error', (input) => true])('anything')).toBe(true); | ||
}); | ||
it('returns last error message if all validators return error', async () => { | ||
expect(await or([() => 'first error', () => 'second error'])('anything')).toMatchInlineSnapshot(`"second error"`); | ||
expect(await or([(input) => 'first error', (input) => 'second error'])('anything')).toMatchInlineSnapshot(`"second error"`); | ||
}); | ||
it('returns override error mmessage if all validators return error', async () => { | ||
expect(await or([() => 'first error', () => 'second error'], 'custom message')('anything')).toMatchInlineSnapshot(`"custom message"`); | ||
expect(await or([(input) => 'first error', (input) => 'second error'], 'custom message')('anything')).toMatchInlineSnapshot( | ||
`"custom message"`, | ||
); | ||
}); | ||
@@ -101,7 +105,7 @@ }); | ||
it('returns error message if validator returns true', async () => { | ||
expect(await not(() => true, 'custom error message')('anything')).toMatchInlineSnapshot(`"custom error message"`); | ||
expect(await not((input) => true, 'custom error message')('anything')).toMatchInlineSnapshot(`"custom error message"`); | ||
}); | ||
it('returns true when validator returns error message', async () => { | ||
expect(await not(() => 'error message', 'other message')('anything')).toBe(true); | ||
expect(await not((input) => 'error message', 'other message')('anything')).toBe(true); | ||
}); | ||
@@ -108,0 +112,0 @@ }); |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
267101
3182
0