Skip to content

Commit

Permalink
Seed data for Resumes (#367)
Browse files Browse the repository at this point in the history
* seed data for resumes

* linting :(

* bruh

* typo

* unncessary file factory export

* added pdf link to resumes
  • Loading branch information
nik-dange authored Nov 5, 2023
1 parent 21031e2 commit e7a1290
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 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,14 @@ async function seed(): Promise<void> {
accessType: UserAccessType.MERCH_STORE_DISTRIBUTOR,
});

const RESUME_URL = 'https://acmucsd-local.s3.us-west-1.amazonaws.com/resumeSeedingData/alexface.pdf';

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

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

// 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 +557,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 +652,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
1 change: 1 addition & 0 deletions tests/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export * from './DatabaseConnection';
export * from './UserFactory';
export * from './EventFactory';
export * from './MerchFactory';
export * from './ResumeFactory';

export * from './PortalState';

0 comments on commit e7a1290

Please sign in to comment.