You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tested TanStack Query for Angular and I really like it so far but I have big problems with unit testing. I even don't get the most basic tests do work unfortunately. Here you can find two really basic test example which should work but don't. The stacklitz example is using Karma but I had the same problems locally with jest ( "jest": "^29.7.0", "jest-preset-angular": "^14.0.3)
First Problem: Angular HarnessLoader ends in timeout
But it returns the error: Async function did not complete within 5000ms. The same example is working, when commenting out the query in the select-overview-example.ts and the select-overview-example.html file. I also played a little around with some deviations of the test (waitForAsync, detectChagens, ...) but without luck
Second Problem: The Query stays pending forever in the unit test
The test also fails as the the text stays "pending" forever. When you open the page normally you however see, that it is immediately changing to "success". Also here I tried some deviations but without luck.
Anyone getting it to work already? Any help is much appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have tested TanStack Query for Angular and I really like it so far but I have big problems with unit testing. I even don't get the most basic tests do work unfortunately. Here you can find two really basic test example which should work but don't. The stacklitz example is using Karma but I had the same problems locally with jest ( "jest": "^29.7.0", "jest-preset-angular": "^14.0.3)
First Problem: Angular HarnessLoader ends in timeout
The first "test" is just these lines :
But it returns the error:
Async function did not complete within 5000ms
. The same example is working, when commenting out the query in theselect-overview-example.ts
and theselect-overview-example.html
file. I also played a little around with some deviations of the test (waitForAsync
,detectChagens
, ...) but without luckSecond Problem: The Query stays pending forever in the unit test
The second unit test is :
The test also fails as the the text stays "pending" forever. When you open the page normally you however see, that it is immediately changing to "success". Also here I tried some deviations but without luck.
Anyone getting it to work already? Any help is much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions