# help

Aleksa Miseljic

05/17/2022, 1:13 PM
Hey everyone, can someone help me with setting up jest with SST? I managed to setup and create int test for my main stacks but when try to run my unit tests I get fellowing error:
I assume that I should mock my db client somehow but Im struggling with finding some docs or tutorials on how to do that. I would highly appreciate some help @Frank @Jay! 😄


05/17/2022, 1:23 PM
I’m not exactly sure about your use case but if I was to mock in jest, generally, I’d do so like this
Copy code
jest.mock('data-api-client', () => ({
  // each of these would the functions on db.
  get: () => ({ some=mock-object-your-client-returns }),
  set: //...


05/19/2022, 2:31 AM
Thanks @Devin!
@Aleksa Miseljic you can either mock as Devin shared, or if you want to connect to real db, you’d make sure the
exists in the testing environment.
You can set them in ur tests directly like suggested here