Create a Smart Action tests with Jest

Feature(s) impacted

Hi there,
I’m trying to setup our first test in our Forest Admin project utilizing Jest library, following this instructions.

We want this test to run on an isolated environment on both local developers machines and CI/CD, regardless of how our current environment in production looks like, in terms of users & data.

I couldn’t fully understood how to hold all this required data for Smart Action test - specifically the User required fields.
when it comes to an isolated environment for testing with Jest.
Can we create a mocked user on the fly while running unit tests / integration tests?
and if so, can you point to me right direction how to do so dynamically?

I refer to this section from Forest Admin Test Documentation

const user = {
  id: //the id of the user to connect with,
  email: //the email of the user to connect with,
  firstName: //the first name of the user to connect with,
  lastName: //the last name of the user to connect with,
  team: //the team name (case sensitive) to connect to,
  renderingId: //the rendering ID to connect to,
}

Thanks in advance,
Avishai

  • Project name: Empathy
  • Team name: All Teams
  • Environment name: Both Local Env and CI/CD env
  • Agent technology: (nodejs)
  • Agent (forest package) name & version: forest-express-sequelize 9.3.20
  • Database type: Postgres
  • Jest version: 29.7.0

Hello, we are developing a new library to test your agent in an isolated environment. The library is in Beta but we we’ve been using it for over a year now.

I will appreciate if you have feedbacks on the library :slight_smile:

Best regards,
Alban

1 Like