Skip to content

Commit 68eb481

Browse files
committed
Updates test names to be "active", updates js-yaml version
1 parent 332a0b3 commit 68eb481

File tree

6 files changed

+99
-93
lines changed

6 files changed

+99
-93
lines changed

tests/frontend/integration/hamburger-nav.intg.test.js

Lines changed: 61 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -64,63 +64,66 @@ beforeEach(() => {
6464
/**********************
6565
* Tests
6666
**********************/
67-
it('should swap burger icons and headerNav visibility when burgerImage is clicked', () => {
68-
let {burgerIcon, burgerXIcon} = getNavIcons();
69-
70-
// Confirm initial state (headerNav style is '', button expanded is null, icon is burger)
71-
expect(headerNav.style.display).toBe("");
72-
expect(burgerImage.getAttribute('aria-expanded')).toBeNull();
73-
expect(burgerIcon).not.toBeNull();
74-
expect(burgerXIcon).toBeNull();
75-
76-
// Click burgerImage to open, re-grab our icon elements
77-
burgerImage.click();
78-
({burgerIcon, burgerXIcon} = getNavIcons());
79-
80-
// Confirm state now (headerNav style is flex, button expanded is true, icon is X)
81-
expect(headerNav.style.display).toBe('flex');
82-
expect(burgerImage.getAttribute('aria-expanded')).toBe('true');
83-
expect(burgerIcon).toBeNull();
84-
expect(burgerXIcon).not.toBeNull();
85-
86-
// Click burgerImage to close, re-grab our icon elements
87-
burgerImage.click();
88-
({burgerIcon, burgerXIcon} = getNavIcons());
89-
90-
// Confirm state now (headerNav style is none, button expanded is false, icon is burger)
91-
expect(headerNav.style.display).toBe('none');
92-
expect(burgerImage.getAttribute('aria-expanded')).toBe('false');
93-
expect(burgerIcon).not.toBeNull();
94-
expect(burgerXIcon).toBeNull();
67+
describe('burger button', () => {
68+
it('swaps burger icons and headerNav visibility when burgerImage is clicked', () => {
69+
let {burgerIcon, burgerXIcon} = getNavIcons();
70+
71+
// Confirm initial state (headerNav style is '', button expanded is null, icon is burger)
72+
expect(headerNav.style.display).toBe("");
73+
expect(burgerImage.getAttribute('aria-expanded')).toBeNull();
74+
expect(burgerIcon).not.toBeNull();
75+
expect(burgerXIcon).toBeNull();
76+
77+
// Click burgerImage to open, re-grab our icon elements
78+
burgerImage.click();
79+
({burgerIcon, burgerXIcon} = getNavIcons());
80+
81+
// Confirm state now (headerNav style is flex, button expanded is true, icon is X)
82+
expect(headerNav.style.display).toBe('flex');
83+
expect(burgerImage.getAttribute('aria-expanded')).toBe('true');
84+
expect(burgerIcon).toBeNull();
85+
expect(burgerXIcon).not.toBeNull();
86+
87+
// Click burgerImage to close, re-grab our icon elements
88+
burgerImage.click();
89+
({burgerIcon, burgerXIcon} = getNavIcons());
90+
91+
// Confirm state now (headerNav style is none, button expanded is false, icon is burger)
92+
expect(headerNav.style.display).toBe('none');
93+
expect(burgerImage.getAttribute('aria-expanded')).toBe('false');
94+
expect(burgerIcon).not.toBeNull();
95+
expect(burgerXIcon).toBeNull();
96+
});
9597
});
9698

97-
it('should reset the navbar properties when resizing the window >767', () => {
98-
let {burgerIcon, burgerXIcon} = getNavIcons();
99-
100-
// Confirm initial state (headerNav style is '', button expanded is null, icon is burger)
101-
expect(headerNav.style.display).toBe("");
102-
expect(burgerImage.getAttribute('aria-expanded')).toBeNull();
103-
expect(burgerIcon).not.toBeNull();
104-
expect(burgerXIcon).toBeNull();
105-
106-
// Click to update the style and icon
107-
burgerImage.click();
108-
({burgerIcon, burgerXIcon} = getNavIcons());
109-
110-
// Confirm state now (headerNav style is flex, button expanded is true, icon is X)
111-
expect(headerNav.style.display).toBe('flex');
112-
expect(burgerImage.getAttribute('aria-expanded')).toBe('true');
113-
expect(burgerIcon).toBeNull();
114-
expect(burgerXIcon).not.toBeNull();
115-
116-
// Resize the Viewport
117-
setViewportWidth(DESKTOP_WIDTH);
118-
({burgerIcon, burgerXIcon} = getNavIcons());
119-
120-
// Confirm state now (headerNav style is null, button is expanded, icon is burger)
121-
expect(headerNav.style.display).toBe('');
122-
expect(burgerImage.getAttribute('aria-expanded')).toBe('true'); // doesn't get reset
123-
expect(burgerIcon).not.toBeNull();
124-
expect(burgerXIcon).toBeNull();
125-
126-
});
99+
describe('window resizing', () => {
100+
it('resets the navbar properties when resizing the window >767', () => {
101+
let {burgerIcon, burgerXIcon} = getNavIcons();
102+
103+
// Confirm initial state (headerNav style is '', button expanded is null, icon is burger)
104+
expect(headerNav.style.display).toBe("");
105+
expect(burgerImage.getAttribute('aria-expanded')).toBeNull();
106+
expect(burgerIcon).not.toBeNull();
107+
expect(burgerXIcon).toBeNull();
108+
109+
// Click to update the style and icon
110+
burgerImage.click();
111+
({burgerIcon, burgerXIcon} = getNavIcons());
112+
113+
// Confirm state now (headerNav style is flex, button expanded is true, icon is X)
114+
expect(headerNav.style.display).toBe('flex');
115+
expect(burgerImage.getAttribute('aria-expanded')).toBe('true');
116+
expect(burgerIcon).toBeNull();
117+
expect(burgerXIcon).not.toBeNull();
118+
119+
// Resize the Viewport
120+
setViewportWidth(DESKTOP_WIDTH);
121+
({burgerIcon, burgerXIcon} = getNavIcons());
122+
123+
// Confirm state now (headerNav style is null, button is expanded, icon is burger)
124+
expect(headerNav.style.display).toBe('');
125+
expect(burgerImage.getAttribute('aria-expanded')).toBe('true'); // doesn't get reset
126+
expect(burgerIcon).not.toBeNull();
127+
expect(burgerXIcon).toBeNull();
128+
});
129+
});

tests/frontend/integration/vrms-events.intg.test.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { jest } from '@jest/globals';
33

44

55
describe('vrmsDataFetch', () => {
6-
it('should return sorted non-test event array and not call appendMeetingTimes for "events" view', async() => {
6+
it('returns sorted non-test event array and not call appendMeetingTimes for "events" view', async() => {
77
// Create a mock function to see if it is called
88
const mockAppend = jest.fn();
99

@@ -26,7 +26,7 @@ describe('vrmsDataFetch', () => {
2626
}
2727
});
2828

29-
it('should call appendMeetingTimes with sorted non-test events for "project" view', async() => {
29+
it('calls appendMeetingTimes with sorted non-test events for "project" view', async() => {
3030
// Create a mock function to see if its called and what it was called with
3131
const mockAppend = jest.fn();
3232

@@ -62,7 +62,7 @@ describe('vrmsDataFetch', () => {
6262
});
6363

6464
describe('localeTimeIn12Format', () => {
65-
it('should return a 12-hour formatted string', () => {
65+
it('returns a 12-hour formatted string', () => {
6666
// Pass in a dummy timestamp checking single digit AM hour format
6767
let timeStr = localeTimeIn12Format("2020-05-13T02:00:00.000Z");
6868
expect (typeof timeStr).toBe('string');
@@ -71,22 +71,22 @@ describe('localeTimeIn12Format', () => {
7171
expect(timeStr).toMatch(/\b([1-9]|1[1-2])\b:\b([0-5][0-9])\b (am|pm)/);
7272
})
7373

74-
it ('should handle single digit AM times correctly', () => {
74+
it ('handles single digit AM times correctly', () => {
7575
const timeStr = localeTimeIn12Format("2025-10-20T01:00:00.000Z");
7676
expect(timeStr).toBe('1:00 am');
7777
})
7878

79-
it ('should handle multi-digit AM times correctly', () => {
79+
it ('handles multi-digit AM times correctly', () => {
8080
const timeStr = localeTimeIn12Format("2025-10-20T10:15:00.000Z");
8181
expect(timeStr).toBe('10:15 am');
8282
})
8383

84-
it ('should handle single-digit PM times correctly', () => {
84+
it ('handles single-digit PM times correctly', () => {
8585
const timeStr = localeTimeIn12Format("2025-10-20T14:31:00.000Z");
8686
expect(timeStr).toBe('2:31 pm');
8787
})
8888

89-
it ('should handle multi-digit PM times correctly', () => {
89+
it ('handles multi-digit PM times correctly', () => {
9090
const timeStr = localeTimeIn12Format("2025-10-20T23:59:00.000Z");
9191
expect(timeStr).toBe('11:59 pm');
9292
})

tests/frontend/unit/current-projects-utils.unit.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const defaultProjectData = [
6060

6161
describe('createFilter', () => {
6262

63-
it('should provide program, technologies, languages, tools, and status filters for non-check pages', () => {
63+
it('returns program, technologies, languages, tools, and status filters for non-check pages', () => {
6464
const filters = createFilter(defaultProjectData);
6565
expect(filters['programs']).not.toBeUndefined();
6666
expect(filters['technologies']).not.toBeUndefined();
@@ -69,7 +69,7 @@ describe('createFilter', () => {
6969
expect(filters['status']).not.toBeUndefined();
7070
});
7171

72-
it('should provide technologies, languages, and tools filters only for check pages', () => {
72+
it('returns technologies, languages, and tools filters only for check pages', () => {
7373
const filters = createFilter(defaultProjectData, true);
7474
expect(filters['technologies']).not.toBeUndefined();
7575
expect(filters['languages']).not.toBeUndefined();
@@ -79,7 +79,7 @@ describe('createFilter', () => {
7979
expect(filters['status']).toBeUndefined();
8080
});
8181

82-
it('should provide a program filter that provides a flat array of programs for non-check pages', () => {
82+
it('returns a program filter that provides a flat array of programs for non-check pages', () => {
8383
const nonCheckfilters = createFilter(defaultProjectData);
8484
const expectedPrograms = [
8585
"Diversity / Equity / Inclusion",
@@ -92,7 +92,7 @@ describe('createFilter', () => {
9292
expect(nonCheckfilters['programs']).toHaveLength(expectedPrograms.length);
9393
});
9494

95-
it('should provide a technologies filter that provides a flat array of technologies for check and non-check pages', () => {
95+
it('returns a technologies filter that provides a flat array of technologies for check and non-check pages', () => {
9696
const checkfilters = createFilter(defaultProjectData);
9797
const nonCheckfilters = createFilter(defaultProjectData);
9898
const expectedTechnologies = ["JavaScript", "Python", "React", "C++"].sort();
@@ -105,7 +105,7 @@ describe('createFilter', () => {
105105
expect(nonCheckfilters['technologies']).toHaveLength(expectedTechnologies.length);
106106
});
107107

108-
it('should provide a languages filter that provides a flat array of languages for check and non-check pages', () => {
108+
it('returns a languages filter that provides a flat array of languages for check and non-check pages', () => {
109109
const checkfilters = createFilter(defaultProjectData);
110110
const nonCheckfilters = createFilter(defaultProjectData);
111111
const expectedLanguages = ["PHP", "Ruby", "C"].sort();
@@ -119,7 +119,7 @@ describe('createFilter', () => {
119119

120120
});
121121

122-
it('should provide a tools filter that provides a flat array of tools for check and non-check pages', () => {
122+
it('returns a tools filter that provides a flat array of tools for check and non-check pages', () => {
123123
const checkfilters = createFilter(defaultProjectData);
124124
const nonCheckfilters = createFilter(defaultProjectData);
125125
const expectedTools = ["Git", "SQL", "Docker"].sort();
@@ -133,7 +133,7 @@ describe('createFilter', () => {
133133

134134
});
135135

136-
it('should provide a status filter that provides a flat array of statuses for check and non-check pages', () => {
136+
it('returns a status filter that provides a flat array of statuses for check and non-check pages', () => {
137137
const nonCheckfilters = createFilter(defaultProjectData);
138138

139139
// TODO: Currently, the project with "empty" status inserts undefined in this filter.
@@ -148,7 +148,7 @@ describe('createFilter', () => {
148148
});
149149

150150
describe("projectDataSorter", () => {
151-
it('should sort projects alphabetically by title and status', () => {
151+
it('sorts projects alphabetically by title and status', () => {
152152
const expectedTitleOrder = [
153153
"Best Project",
154154
"Test Project",

tests/frontend/unit/vrms-events-utils.unit.test.mjs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,27 @@ const testEvents = [
99
{ name: 'Late Meeting', date: '2025-10-20', startTime: '2025-10-20T23:00:00Z', endTime: '2025-10-20T23:59:00Z', project: { name: 'Project B' } }
1010
];
1111

12-
it('sortEventsByDate should return sorted events', async() => {
12+
describe('sortEventsByDate', () => {
13+
it('returns sorted events', async() => {
1314

14-
// Call sortEventsByDate with testEvents
15-
const sortedEvents = sortEventsByDate(testEvents);
15+
// Call sortEventsByDate with testEvents
16+
const sortedEvents = sortEventsByDate(testEvents);
1617

17-
for (let i = 1; i < sortedEvents.length; i++) {
18-
expect(new Date(sortedEvents[i].date) >= new Date(sortedEvents[i-1].date)).toBe(true);
19-
expect(new Date(sortedEvents[i].startTime) >= new Date(sortedEvents[i-1].startTime)).toBe(true);
20-
}
21-
});
18+
for (let i = 1; i < sortedEvents.length; i++) {
19+
expect(new Date(sortedEvents[i].date) >= new Date(sortedEvents[i-1].date)).toBe(true);
20+
expect(new Date(sortedEvents[i].startTime) >= new Date(sortedEvents[i-1].startTime)).toBe(true);
21+
}
22+
});
23+
})
2224

25+
describe('filterTestEvents', () => {
26+
it('filters out test events', async() => {
2327

24-
it('filterTestEvents should filter out test events', async() => {
28+
// Call sortEventsByDate with testEvents
29+
const filteredEvents = filterTestEvents(testEvents);
2530

26-
// Call sortEventsByDate with testEvents
27-
const filteredEvents = filterTestEvents(testEvents);
28-
29-
// Make sure that no event names match the /test/i regex (test doesn't appear, case insensitive)
30-
expect(filteredEvents.every(event => /test/i.test(event.name) === false)).toBe(true);
31-
});
31+
// Make sure that no event names match the /test/i regex (test doesn't appear, case insensitive)
32+
expect(filteredEvents.every(event => /test/i.test(event.name) === false)).toBe(true);
33+
});
34+
})
3235

tests/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"gray-matter": "^4.0.3",
88
"jest": "^30.2.0",
99
"jest-environment-jsdom": "^30.2.0",
10-
"js-yaml": "^4.1.0",
10+
"js-yaml": "^4.1.1",
1111
"liquidjs": "^10.24.0"
1212
}
1313
}

0 commit comments

Comments
 (0)