fix: refactor tests (#1066)

## Changes Made

- Refactor/optimise tests
- Reduce flakiness
- Add parallel tests (if there's enough CPU capacity)
- Removed explicit worker count when running parallel tests. Defaults to
50% of CPU capacity.

Might want to consider sharding the test across runners in the future as
our tests grows.
This commit is contained in:
David Nguyen
2024-04-03 17:13:35 +08:00
committed by GitHub
parent d1ffcb00f3
commit 56c550c9d2
19 changed files with 318 additions and 732 deletions

View File

@ -1,8 +1,11 @@
import { customAlphabet } from 'nanoid';
import { prisma } from '..';
import { TeamMemberInviteStatus, TeamMemberRole } from '../client';
import { seedUser } from './users';
const EMAIL_DOMAIN = `test.documenso.com`;
const nanoid = customAlphabet('1234567890abcdef', 10);
type SeedTeamOptions = {
createTeamMembers?: number;
@ -13,7 +16,7 @@ export const seedTeam = async ({
createTeamMembers = 0,
createTeamEmail,
}: SeedTeamOptions = {}) => {
const teamUrl = `team-${Date.now()}`;
const teamUrl = `team-${nanoid()}`;
const teamEmail = createTeamEmail === true ? `${teamUrl}@${EMAIL_DOMAIN}` : createTeamEmail;
const teamOwner = await seedUser({