test.each doesnt works with interpolation with object properties
See original GitHub issuetest.each([
{
pageSize: 100,
pageNumber: 1,
// 0 - 10
targetPageSize: 500,
expected: [{pageSize: 500, pageNumber: 1}],
},
{
pageSize: 500,
pageNumber: 1,
// 0 - 500
targetPageSize: 500,
expected: [{pageSize: 500, pageNumber: 1}],
},
{
pageSize: 1000,
pageNumber: 1,
// 0 - 1000
targetPageSize: 500,
expected: [{pageSize: 500, pageNumber: 1}, {pageSize: 500, pageNumber: 2}],
},
{
pageSize: 55,
pageNumber: 10,
// 495 - 550
targetPageSize: 500,
expected: [{pageSize: 500, pageNumber: 1}, {pageSize: 500, pageNumber: 2}],
},
{
pageSize: 999,
pageNumber: 2,
// 999 - 1998
targetPageSize: 500,
expected: [{pageSize: 500, pageNumber: 2}, {pageSize: 500, pageNumber: 3}, {pageSize: 500, pageNumber: 4}],
},
])(
'.convertPagination({pageSize: $pageSize, pageNumber: $pageNumber}, $targetPageSize)',
({pageNumber, pageSize, targetPageSize, expected}) => {
const reportDataRepository = new ReportDataRepository();
// @ts-ignore
const converted = reportDataRepository.convertPagination({pageSize, pageNumber}, targetPageSize);
expect(converted).toStrictEqual(expected);
},
);
Log into console
✓ .convertPagination({pageSize: $pageSize, pageNumber: $pageNumber}, $targetPageSize) (30 ms)
✓ .convertPagination({pageSize: $pageSize, pageNumber: $pageNumber}, $targetPageSize) (1 ms)
✓ .convertPagination({pageSize: $pageSize, pageNumber: $pageNumber}, $targetPageSize) (1 ms)
✓ .convertPagination({pageSize: $pageSize, pageNumber: $pageNumber}, $targetPageSize) (1 ms)
✓ .convertPagination({pageSize: $pageSize, pageNumber: $pageNumber}, $targetPageSize) (1 ms)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
jest .each name access object key - javascript - Stack Overflow
Jest describe.each expects an array of arrays in the first parameter. If you pass in a 1D array, internally it will be mapped...
Read more >Understanding Angular property binding and interpolation
Learn about property binding and interpolation so you can understand which method best suits the task at hand.
Read more >Template literals (Template strings) - JavaScript | MDN
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded ...
Read more >Karate | Test Automation Made Simple.
Karate is the only open-source tool to combine API test-automation, mocks, performance-testing and even UI automation into a single, unified framework.
Read more >A tour of the Dart language
' 'STRING INTERPOLATION is very handy!'); Note: The == operator tests whether two objects are equivalent. Two strings are equivalent if ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Jest 24 is not supported any more and won’t receive updates/back-porting. But I see
@vue/cli-plugin-unit-jest
added support for Jest 26 in vuejs/vue-cli/pull/6116 and appears to have included it in the ongoing beta for version 5.x. @cexbrayat has kindly started the work on Jest 27 in vuejs/vue-cli/pull/6627 as well - but I don’t know if that would be able to make it into 5.x.@martindzejky the
vue-jest
transformer appears to already support 27.x for both Vue 2 and 3 though. And@vue/cli-plugin-unit-jest
mainly provide some Jest presets in addition to cli-tooling for initialising or migrating. So perhaps you can extract what you need and upgrade yourself if waiting on them adding support is not an option. 🙂This was fixed in Jest 27, so I’d suggest upgrading to the latest (27.0.6) if you can