Error testing Activatedroute with angular jest 9

Asked

Viewed 52 times

-1

First thank you for reading my question!

Setting:

I’m testing an angular 9 application with jest of a component using a solver class'.

I tried to set up a mock to resolve it, but when running tests I always get an error, saying the snapshot date property is not defined.

Follow the test configuration print:

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • that your mock has this snapshot and date property?

  • Hello Eduardo. tried this way tbm: route: { snapshot: { data: {campaigns: campanhasFake} } } But the way jest is mounted should simulate these snapshot and date properties.

1 answer

0

wrong: route: { snapshot: { data: {campaigns: campanhasFake} } }

correct: { snapshot: { date: {campaigns: campanhasFake} } }

the error was to use the route property on the object.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.