refactor(site): Show update notification as snackbar (#7546)

This commit is contained in:
Bruno Quaresma
2023-05-17 13:56:26 -03:00
committed by GitHub
parent a7f14f89e3
commit 12f87cb98d
7 changed files with 114 additions and 103 deletions
+28
View File
@@ -166,3 +166,31 @@ user.click(screen.getByRole("button"))
const form = screen.getByTestId("form")
user.click(within(form).getByRole("button"))
```
#### `jest.spyOn` with the API is not working
For some unknown reason, we figured out the `jest.spyOn` is not able to mock the API function when they are passed directly into the services XState machine configuration.
❌ Does not work
```ts
import { getUpdateCheck } from "api/api"
createMachine({ ... }, {
services: {
getUpdateCheck,
},
})
```
✅ It works
```ts
import { getUpdateCheck } from "api/api"
createMachine({ ... }, {
services: {
getUpdateCheck: () => getUpdateCheck(),
},
})
```