|
| 1 | +import {getTester} from './utils/test.mjs'; |
| 2 | + |
| 3 | +const {test} = getTester(import.meta); |
| 4 | + |
| 5 | +test.snapshot({ |
| 6 | + valid: [ |
| 7 | + 'Promise.all([promise1, promise2, promise3, promise4])', |
| 8 | + 'Promise.allSettled([promise1, promise2, promise3, promise4])', |
| 9 | + 'Promise.any([promise1, promise2, promise3, promise4])', |
| 10 | + 'Promise.race([promise1, promise2, promise3, promise4])', |
| 11 | + 'Promise.all(...[await promise])', |
| 12 | + 'Promise.all([await promise], extraArguments)', |
| 13 | + 'Promise.all()', |
| 14 | + 'Promise.all(notArrayExpression)', |
| 15 | + 'Promise.all([,])', |
| 16 | + 'Promise[all]([await promise])', |
| 17 | + 'Promise.all?.([await promise])', |
| 18 | + 'Promise?.all([await promise])', |
| 19 | + 'Promise.notListedMethod([await promise])', |
| 20 | + 'NotPromise.all([await promise])', |
| 21 | + 'Promise.all([(await promise, 0)])', |
| 22 | + 'new Promise.all([await promise])', |
| 23 | + |
| 24 | + // We are not checking these cases |
| 25 | + 'globalThis.Promise.all([await promise])', |
| 26 | + 'Promise["all"]([await promise])', |
| 27 | + ], |
| 28 | + invalid: [ |
| 29 | + 'Promise.all([await promise])', |
| 30 | + 'Promise.allSettled([await promise])', |
| 31 | + 'Promise.any([await promise])', |
| 32 | + 'Promise.race([await promise])', |
| 33 | + 'Promise.all([, await promise])', |
| 34 | + 'Promise.all([await promise,])', |
| 35 | + 'Promise.all([await promise],)', |
| 36 | + 'Promise.all([await (0, promise)],)', |
| 37 | + 'Promise.all([await (( promise ))])', |
| 38 | + 'Promise.all([await await promise])', |
| 39 | + 'Promise.all([...foo, await promise1, await promise2])', |
| 40 | + 'Promise.all([await /* comment*/ promise])', |
| 41 | + ], |
| 42 | +}); |
0 commit comments