8000 Add regression test for PR #272: locked equity allocation by devin-ai-integration[bot] · Pull Request #275 · antiwork/flexile · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add regression test for PR #272: locked equity allocation #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions e2e/tests/company/invoices/locked-equity-allocation.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { companiesFactory } from "@test/factories/companies";
import { companyContractorsFactory } from "@test/factories/companyContractors";
import { equityAllocationsFactory } from "@test/factories/equityAllocations";
import { usersFactory } from "@test/factories/users";
import { login } from "@test/helpers/auth";
import { expect, test } from "@test/index";
import { PayRateType } from "@/db/enums";

test.describe("Invoice equity percentage with locked allocations", () => {
test("sets default invoice equity percentage based on locked allocation", async ({ page }) => {
const { company } = await companiesFactory.createCompletedOnboarding({
equityCompensationEnabled: true,
});

const { user } = await usersFactory.create();

const { companyContractor } = await companyContractorsFactory.create({
companyId: company.id,
userId: user.id,
payRateInSubunits: 5000, // $50/hr
payRateType: PayRateType.Hourly,
});

const currentYear = new Date().getFullYear();
await equityAllocationsFactory.create({
companyContractorId: companyContractor.id,
equityPercentage: 30,
year: currentYear,
locked: true,
status: "approved",
});

await login(page, user);

await page.goto("/invoices/new");

await expect(page.getByRole("textbox", { name: "Cash vs equity split" })).toHaveValue("30");

await expect(page.getByRole("textbox", { name: "Cash vs equity split" })).toBeDisabled();

await page.getByLabel("Hours").fill("2:00");
await page.getByLabel("Date").fill(`${currentYear}-05-01`);
await page.getByPlaceholder("Description").fill("Test work");

const totalsLocator = page.locator("footer > div:last-child");
await expect(totalsLocator).toContainText("Total services$100");
await expect(totalsLocator).toContainText("Swapped for equity (not paid in cash)$30");
await expect(totalsLocator).toContainText("Net amount in cash$70");

await page.getByRole("button", { name: "Send invoice" }).click();

await expect(page.locator("tbody")).toContainText("Awaiting approval");
});
});
Loading
0