Update mapper_test.js

This commit is contained in:
Clément 2020-06-17 14:07:25 +02:00 committed by GitHub
parent 2881e95efe
commit 45e04049da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -87,7 +87,27 @@ t(({ eq, ctx }) =>
),
)
t(({ eq, ctx }) =>
// map should not flat
eq(
map([1, 2, 3], n => [n, n]),
[
[1, 1],
[2, 2],
[3, 3],
],
),
)
// flatMap
t(({ eq, ctx }) =>
// flatMap should flatten the result of map
eq(
flatMap([1, 2, 3], n => [n, n]),
[1, 1, 2, 2, 3, 3],
),
)
t(({ eq, ctx }) =>
eq(flatMap(ctx.mixed, add1), ['101', -9, 21, -94, 87, '1021', '35,891', 111]),
)