Skip to content

Commit bbf2e69

Browse files
committed
update
1 parent b0cc9e4 commit bbf2e69

File tree

3 files changed

+32
-25
lines changed

3 files changed

+32
-25
lines changed

.husky/pre-commit

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
41
# Get all staged files
52
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR)
63

74
if [ -n "$STAGED_FILES" ]; then
85
echo "Running lint with fix on staged files..."
96
# Run lint on all files (modifies files in the working directory)
107
yarn lint --fix
8+
yarn prettier:write
119

1210
echo "Re-adding originally staged files to the staging area..."
1311
# Re-add only the originally staged files

tests/e2e/base.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ async function getSecrets() {
4141

4242
const secrets = await getSecrets();
4343

44+
export function capitalizeFirstLetter(string: string) {
45+
return string.charAt(0).toUpperCase() + string.slice(1);
46+
}
47+
4448
async function becomeUser(page) {
4549
await page.goto("https://manage.qa.acmuiuc.org/login");
4650
await page
@@ -58,21 +62,21 @@ async function becomeUser(page) {
5862
}
5963

6064
export async function getUpcomingEvents() {
61-
const data = await fetch('https://infra-core-api.aws.qa.acmuiuc.org/api/v1/events?upcomingOnly=true');
62-
return await data.json() as Record<string, string>[];
65+
const data = await fetch(
66+
"https://infra-core-api.aws.qa.acmuiuc.org/api/v1/events?upcomingOnly=true",
67+
);
68+
return (await data.json()) as Record<string, string>[];
6369
}
6470

6571
export async function getAllEvents() {
66-
const data = await fetch('https://infra-core-api.aws.qa.acmuiuc.org/api/v1/events');
67-
return await data.json() as Record<string, string>[];
68-
}
69-
70-
export function capitalizeFirstLetter(string: string) {
71-
return string.charAt(0).toUpperCase() + string.slice(1);
72+
const data = await fetch(
73+
"https://infra-core-api.aws.qa.acmuiuc.org/api/v1/events",
74+
);
75+
return (await data.json()) as Record<string, string>[];
7276
}
7377

7478
export const test = base.extend<{ becomeUser: (page) => Promise<void> }>({
75-
becomeUser: async ({ }, use) => {
79+
becomeUser: async ({}, use) => {
7680
use(becomeUser);
7781
},
7882
});

tests/e2e/events.spec.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,32 @@ describe("Events tests", () => {
88
becomeUser,
99
}) => {
1010
await becomeUser(page);
11-
await page.locator('a').filter({ hasText: 'Events' }).click();
12-
await expect(page.getByRole('heading')).toContainText('Core Management Service (NonProd)');
13-
await expect(page.getByRole('button', { name: 'New Calendar Event' })).toBeVisible();
14-
await expect(page.getByRole('button', { name: 'Show Previous Events' })).toBeVisible();
11+
await page.locator("a").filter({ hasText: "Events" }).click();
12+
await expect(page.getByRole("heading")).toContainText(
13+
"Core Management Service (NonProd)",
14+
);
15+
await expect(
16+
page.getByRole("button", { name: "New Calendar Event" }),
17+
).toBeVisible();
18+
await expect(
19+
page.getByRole("button", { name: "Show Previous Events" }),
20+
).toBeVisible();
1521

16-
const table = page.getByTestId('events-table');
22+
const table = page.getByTestId("events-table");
1723
await expect(table).toBeVisible();
1824

19-
const rows = await table.locator('tbody tr').all();
25+
const rows = await table.locator("tbody tr").all();
2026
const expectedTableData = await getUpcomingEvents();
2127

2228
for (let i = 0; i < rows.length; i++) {
2329
const row = rows[i];
2430
const expectedData = expectedTableData[i];
25-
26-
const title = await row.locator('td:nth-child(1)').innerText();
27-
const location = await row.locator('td:nth-child(4)').innerText();
28-
const description = await row.locator('td:nth-child(5)').innerText();
29-
const host = await row.locator('td:nth-child(6)').innerText();
30-
const featured = await row.locator('td:nth-child(7)').innerText();
31-
const repeats = await row.locator('td:nth-child(8)').innerText();
31+
const title = await row.locator("td:nth-child(1)").innerText();
32+
const location = await row.locator("td:nth-child(4)").innerText();
33+
const description = await row.locator("td:nth-child(5)").innerText();
34+
const host = await row.locator("td:nth-child(6)").innerText();
35+
const featured = await row.locator("td:nth-child(7)").innerText();
36+
const repeats = await row.locator("td:nth-child(8)").innerText();
3237

3338
expect(title).toEqual(expectedData.title);
3439
expect(location).toEqual(expectedData.location);

0 commit comments

Comments
 (0)