Skip to content
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

Seed data for Resumes #367

Merged
merged 7 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
12 changes: 11 additions & 1 deletion tests/Seeds.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as moment from 'moment';
import { UserAccessType } from '../types';
import { DatabaseConnection, EventFactory, MerchFactory, PortalState, UserFactory } from './data';
import { DatabaseConnection, EventFactory, MerchFactory, PortalState, UserFactory, ResumeFactory } from './data';

function getGraduationYear(n: number) {
return moment().year() + n;
Expand Down Expand Up @@ -116,6 +116,12 @@ async function seed(): Promise<void> {
accessType: UserAccessType.MERCH_STORE_DISTRIBUTOR,
});

const USER_VISIBLE_RESUME = UserFactory.fake();
const RESUME_1 = ResumeFactory.fake({ user: USER_VISIBLE_RESUME, isResumeVisible: true });

const USER_HIDDEN_RESUME = UserFactory.fake();
const RESUME_2 = ResumeFactory.fake({ user: USER_HIDDEN_RESUME, isResumeVisible: false });

// create members in bulk for testing things like sliding leaderboard in a realistic manner
const otherMembers = UserFactory.create(200);
const highAttendanceMembers = otherMembers.slice(0, 50);
Expand Down Expand Up @@ -549,6 +555,8 @@ async function seed(): Promise<void> {
USER_MARKETING,
USER_MERCH_STORE_MANAGER,
USER_MERCH_STORE_DISTRIBUTOR,
USER_VISIBLE_RESUME,
USER_HIDDEN_RESUME,
...otherMembers,
)
.createEvents(
Expand Down Expand Up @@ -642,6 +650,8 @@ async function seed(): Promise<void> {
.orderMerch(MEMBER_SOPHOMORE, [{ option: MERCH_ITEM_2_OPTION_2X2, quantity: 1 }], ONGOING_ORDER_PICKUP_EVENT)
.orderMerch(MEMBER_JUNIOR, [{ option: MERCH_ITEM_2_OPTION_4X4, quantity: 2 }], ONGOING_ORDER_PICKUP_EVENT)
.orderMerch(MEMBER_SENIOR, [{ option: MERCH_ITEM_2_OPTION_3X3, quantity: 1 }], ONGOING_ORDER_PICKUP_EVENT)
.createResumes(USER_VISIBLE_RESUME, RESUME_1)
.createResumes(USER_HIDDEN_RESUME, RESUME_2)
.write();
}

Expand Down
2 changes: 2 additions & 0 deletions tests/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ export * from './DatabaseConnection';
export * from './UserFactory';
export * from './EventFactory';
export * from './MerchFactory';
export * from './ResumeFactory';
export * from './FileFactory';
nik-dange marked this conversation as resolved.
Show resolved Hide resolved

export * from './PortalState';