# Create a Smart Action tests with Jest

**URL:** <https://community.forestadmin.com/t/create-a-smart-action-tests-with-jest/7967>\
**Category:** Help me!\
**Tags:** howtos\
**Created:** [March 11, 2025, 11:08am UTC](https://community.forestadmin.com/t/create-a-smart-action-tests-with-jest/7967 "2025-03-11T11:08:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avishai\_Lippner](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/avishai_lippner/32/5498_2.png) [@Avishai\_Lippner](https://community.forestadmin.com/u/Avishai_Lippner)\
**Post date:** [March 11, 2025, 11:08am UTC](https://community.forestadmin.com/t/create-a-smart-action-tests-with-jest/7967/1 "2025-03-11T11:08:55Z")

</div>

## Feature(s) impacted

Hi there,  
I’m trying to setup our first test in our Forest Admin project utilizing Jest library, following [this](https://docs.forestadmin.com/woodshop/how-tos/run-automated-tests) 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

```javascript
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

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [March 11, 2025, 11:14am UTC](https://community.forestadmin.com/t/create-a-smart-action-tests-with-jest/7967/2 "2025-03-11T11:14:36Z")

</div>

Hello, we are developing a new [library](https://github.com/ForestAdmin/forestadmin-experimental/tree/main/packages/agent-nodejs-testing) 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 🙂

Best regards,  
Alban

---

<div class="post-metadata">

**Author:** ![Avishai\_Lippner](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/avishai_lippner/32/5498_2.png) [@Avishai\_Lippner](https://community.forestadmin.com/u/Avishai_Lippner)\
**Post date:** [March 30, 2025, 9:46am UTC](https://community.forestadmin.com/t/create-a-smart-action-tests-with-jest/7967/3 "2025-03-30T09:46:08Z")

</div>

No problem I’ll share any feedback if I have  
Thanks @Alban_Bertolini
