From 9310daf9f9dffd3584c0f017c96a209ed904be3e Mon Sep 17 00:00:00 2001
From: Steven Steiner <steets250@gmail.com>
Date: Mon, 7 Feb 2022 14:41:40 -0800
Subject: [PATCH] Update Seeds and Readme (#282)

---
 README.md      | 14 +++++++++++++
 tests/Seeds.ts | 56 +++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 67 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 42fc2e25..238b4a4d 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,20 @@ CLIENT=localhost:8000
 
 Take a look at [`package.json`](https://github.com/acmucsd/membership-portal/blob/master/package.json) for the actual commands.
 
+### Testing Information
+After having executed `npm run db:seed`, `tests/Seeds.ts` will have been used to generate sample data. For all testing accounts, the password is `password`. To test basic features of the portal, `acm@ucsd.edu` can be used for the demo admin account, and any  seed email (e.g. `s3bansal@ucsd.edu`) can be used for a demo member account.
+
+For testing out the different portal roles, use the email `acm_[role]@ucsd.edu`, such that `[role]` is replaced with any of the following terms:
+* `restricted` - User has been blocked from appearing on the leaderboard, although their account is still valid.
+* `standard` - The default user role for all member accounts.
+* `staff` - User is able to check in to events as a staff member.
+* `admin` - User has full permissions to administrate the portal and store.
+* `marketing` - User is able to create and edit events.
+* `store_manager` - User is able to administrate store, including modifying collections, items, options, stock, and pricing.
+* `store_distributor` - User is able to execute store distributions, including viewing and fulfilling orders for each pickup event.
+
+For testing out the store, use the email `acm_store@ucsd.edu`, as the majority of demo orders will be placed with this account.
+
 ### Upgrading to Latest Version
 The first iteration of the membership portal is a JavaScript app written in 2019. The second and latest iteration, written 2020, is a TypeScript app built with better reliability and error handling, stronger concurrency guarantees, and a smoother development experience in mind, and includes a number of breaking changes at the API and database levels. For a more concrete list of improvements, see [acmucsd/membership-portal#115](https://github.com/acmucsd/membership-portal/pull/115).
 
diff --git a/tests/Seeds.ts b/tests/Seeds.ts
index aa770fd2..601a5934 100644
--- a/tests/Seeds.ts
+++ b/tests/Seeds.ts
@@ -80,6 +80,42 @@ async function seed(): Promise<void> {
     graduationYear: getGraduationYear(0),
   });
 
+  // Used for testing out user view of the merch store
+  const USER_STORE = UserFactory.fake({
+    email: 'acm_store@ucsd.edu',
+    points: 500,
+  });
+
+  // Used for testing out user access types
+  const USER_RESTRICTED = UserFactory.fake({
+    email: 'acm_restricted@ucsd.edu',
+    accessType: UserAccessType.RESTRICTED,
+  });
+  const USER_STANDARD = UserFactory.fake({
+    email: 'acm_standard@ucsd.edu',
+    accessType: UserAccessType.STANDARD,
+  });
+  const USER_STAFF = UserFactory.fake({
+    email: 'acm_staff@ucsd.edu',
+    accessType: UserAccessType.STAFF,
+  });
+  const USER_ADMIN = UserFactory.fake({
+    email: 'acm_admin@ucsd.edu',
+    accessType: UserAccessType.ADMIN,
+  });
+  const USER_MARKETING = UserFactory.fake({
+    email: 'acm_marketing@ucsd.edu',
+    accessType: UserAccessType.MARKETING,
+  });
+  const USER_MERCH_STORE_MANAGER = UserFactory.fake({
+    email: 'acm_store_manager@ucsd.edu',
+    accessType: UserAccessType.MERCH_STORE_MANAGER,
+  });
+  const USER_MERCH_STORE_DISTRIBUTOR = UserFactory.fake({
+    email: 'acm_store_distributor@ucsd.edu',
+    accessType: UserAccessType.MERCH_STORE_DISTRIBUTOR,
+  });
+
   // 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);
@@ -494,6 +530,14 @@ async function seed(): Promise<void> {
       MEMBER_SOPHOMORE,
       MEMBER_JUNIOR,
       MEMBER_SENIOR,
+      USER_STORE,
+      USER_RESTRICTED,
+      USER_STANDARD,
+      USER_STAFF,
+      USER_ADMIN,
+      USER_MARKETING,
+      USER_MERCH_STORE_MANAGER,
+      USER_MERCH_STORE_DISTRIBUTOR,
       ...otherMembers,
     )
     .createEvents(
@@ -577,9 +621,15 @@ async function seed(): Promise<void> {
       MERCH_COLLECTION_2,
     )
     .createOrderPickupEvents(PAST_ORDER_PICKUP_EVENT, ONGOING_ORDER_PICKUP_EVENT, FUTURE_ORDER_PICKUP_EVENT)
-    .orderMerch(MEMBER_SOPHOMORE, [{ option: MERCH_ITEM_1_OPTION_M, quantity: 1 }], PAST_ORDER_PICKUP_EVENT)
-    .orderMerch(MEMBER_SOPHOMORE, [{ option: MERCH_ITEM_1_OPTION_M, quantity: 1 }], PAST_ORDER_PICKUP_EVENT)
-    .orderMerch(MEMBER_SOPHOMORE, [{ option: MERCH_ITEM_1_OPTION_M, quantity: 1 }], ONGOING_ORDER_PICKUP_EVENT)
+    .orderMerch(USER_STORE, [{ option: MERCH_ITEM_1_OPTION_M, quantity: 1 }], PAST_ORDER_PICKUP_EVENT)
+    .orderMerch(USER_STORE, [{ option: MERCH_ITEM_1_OPTION_L, quantity: 1 }], PAST_ORDER_PICKUP_EVENT)
+    .orderMerch(MEMBER_JUNIOR, [{ option: MERCH_ITEM_2_OPTION_4X4, quantity: 2 }], PAST_ORDER_PICKUP_EVENT)
+    .orderMerch(USER_STORE, [{ option: MERCH_ITEM_2_OPTION_3X3, quantity: 1 }], ONGOING_ORDER_PICKUP_EVENT)
+    .orderMerch(MEMBER_FRESHMAN, [{ option: MERCH_ITEM_2_OPTION_3X3, quantity: 1 }], ONGOING_ORDER_PICKUP_EVENT)
+    .orderMerch(MEMBER_SOPHOMORE, [{ option: MERCH_ITEM_2_OPTION_2X2, quantity: 1 }], ONGOING_ORDER_PICKUP_EVENT)
+    .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)
     .write();
 }