chore: routingform org attribute seed#17510
Conversation
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
| ], | ||
| }, | ||
| { | ||
| ...Array.from({ length: 10 }, (_, i) => ({ |
There was a problem hiding this comment.
Creates 10 members . Feel free to change length to anything you want to test orgs
|
|
||
| const attributeRaw: { id: string; options: { id: string; value: string }[] }[] = []; | ||
|
|
||
| for (const attr of mockAttributes) { |
There was a problem hiding this comment.
Assign users random attributes
| { | ||
| id: "8a898988-89ab-4cde-b012-31823f708642", | ||
| value: "team/insights-team/team-javascript", | ||
| }, | ||
| { | ||
| id: "8b2224b2-89ab-4cde-b012-31823f708642", | ||
| value: "team/insights-team/team-sales", | ||
| }, |
There was a problem hiding this comment.
Key info needed that can't change as its used in routingFormResponses
| }, | ||
| ], | ||
| formFieldFilled: { | ||
| id: "83316968-45bf-4c9d-b5d4-5368a8d2d2a8", |
There was a problem hiding this comment.
This formField that is filled when the users previews the attribute
| if (attributeRaw.length === 0) { | ||
| throw new Error("No attributes found - Please call seedAttributes first"); | ||
| } |
There was a problem hiding this comment.
Make this dependant on attributes
| properties: { | ||
| field: attributeRaw[2].id, | ||
| value: [ | ||
| attributeRaw[2].options.filter((opt) => opt.value === "JavaScript").map((opt) => opt.id), |
There was a problem hiding this comment.
This currently relys on the set attributeArray being passed in. Down the line we can make this more flexible of a factory if we really need
| ], | ||
| fields: [ | ||
| { | ||
| id: seededForm.formFieldFilled.id, |
There was a problem hiding this comment.
The field ID we use to fill in the form
| options: attributeRaw[2].options.map((opt) => ({ | ||
| id: opt.id, | ||
| label: opt.value, | ||
| })), |
There was a problem hiding this comment.
Make sure options and id are the same so we can link to responses
| response: { | ||
| [seededForm.formFieldFilled.id]: { | ||
| label: "skills", | ||
| value: selectedSkills.map((opt) => opt.id), |
There was a problem hiding this comment.
We can pass multiple responses in here Note: These responses may not match the rules that are created. They are just for visual and display purposes for insights.
| }, | ||
| }); | ||
|
|
||
| if (!insightsAdmin) { |
There was a problem hiding this comment.
Note we may need to add this user back. I'm pretty sure it is used in a e2e test. Will check just wanted to get this out for early reviews
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (11/06/24)1 reviewer was added to this PR based on Keith Williams's automation. |
|
Works great !! |
|
test failing @sean-brydon |
E2E results are ready! |
| where: { email: "member2-acme@example.com" }, | ||
| }); | ||
|
|
||
| expect(accessibleUserIds.length).toBe(3); |

What does this PR do?
This PR adds a way to seed a organization with routing forms and attirbutes.
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Reset your DB.
Run migrations
Run yarn seed (This should create an acme organization with now 10 users to make this a bit easier - you can change this value if you want more users in your org).
Run yarn seed-insights - This will seed the "Acme" org with a bunch of data. Previous bookings, Teams, Routing forms and attributes
Checklist