/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/compose/src/higher-order/test/compose.ts
35 строк
1 KB
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import compose from '../compose'; describe( 'compose', () => { it( 'returns the initial value if no functions are specified', () => { expect( compose()( 'test' ) ).toBe( 'test' ); } ); it( 'executes functions right-to-left when passed as separate arguments', () => { const a = ( value ) => ( value += 'a' ); const b = ( value ) => ( value += 'b' ); const c = ( value ) => ( value += 'c' ); expect( compose( a, b, c )( 'test' ) ).toBe( 'testcba' ); } ); it( 'executes functions right-to-left when passed as a single array', () => { const a = ( value ) => ( value += 'a' ); const b = ( value ) => ( value += 'b' ); const c = ( value ) => ( value += 'c' ); expect( compose( [ a, b, c ] )( 'test' ) ).toBe( 'testcba' ); } ); it( 'executes functions right-to-left when passed as a mix of separate arguments and arrays', () => { const a = ( value ) => ( value += 'a' ); const b = ( value ) => ( value += 'b' ); const c = ( value ) => ( value += 'c' ); const d = ( value ) => ( value += 'd' ); const e = ( value ) => ( value += 'e' ); expect( compose( [ a, b ], c, [ d ], e )( 'test' ) ).toBe( 'testedcba' ); } ); } );