Skip to content

Commit

Permalink
Merge branch 'main' into justin/clarity-branding
Browse files Browse the repository at this point in the history
  • Loading branch information
justinschreiner authored Nov 27, 2024
2 parents d17c8e5 + 582ddd7 commit 9724c98
Show file tree
Hide file tree
Showing 43 changed files with 539 additions and 196 deletions.
6 changes: 0 additions & 6 deletions __mocks__/getRepresentatives/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const getRepresentativesHandlers = [
is_alternate: false,
workshop_id: BigInt(1).toString(),
email: '[email protected]',
color: '#000000',
wallet_address: 'addr1isdufnpoasidjfopmaimdfmopisadj',
name: 'John Johnson',
},
Expand All @@ -21,7 +20,6 @@ export const getRepresentativesHandlers = [
is_alternate: true,
workshop_id: BigInt(1).toString(),
email: '[email protected]',
color: '#000000',
wallet_address: 'addr1oqwieuroijfvaondsfipoaapoidjf',
name: 'Mike Mickelson',
},
Expand All @@ -32,7 +30,6 @@ export const getRepresentativesHandlers = [
is_alternate: false,
workshop_id: BigInt(2).toString(),
email: '[email protected]',
color: '#000000',
wallet_address: 'addr1kidjfsadjfoadspjfoaidsfadsop',
name: 'Jack Jackson',
},
Expand All @@ -43,7 +40,6 @@ export const getRepresentativesHandlers = [
is_alternate: true,
workshop_id: BigInt(2).toString(),
email: '[email protected]',
color: '#000000',
wallet_address: 'addr1iwoiuwqxpoieujsoidpjfkfjhpqowmfoa',
name: 'Robert Robertson',
},
Expand All @@ -54,7 +50,6 @@ export const getRepresentativesHandlers = [
is_alternate: false,
workshop_id: BigInt(3).toString(),
email: '[email protected]',
color: '#000000',
wallet_address: 'addr1opijpoiuoimnlkjipoujpoimlkkm',
name: 'Connor Connorson',
},
Expand All @@ -65,7 +60,6 @@ export const getRepresentativesHandlers = [
is_alternate: true,
workshop_id: BigInt(3).toString(),
email: '[email protected]',
color: '#000000',
wallet_address: 'addr1adfasdfwerwqersdvfzxfvsadf',
name: 'Kyle Kyleson',
},
Expand Down
20 changes: 10 additions & 10 deletions __mocks__/updateUser/errorHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const updateUserActiveVoteHandler = [
http.post('/api/updateUser', async () => {
return HttpResponse.json(
{
pollId: BigInt(-1).toString(),
userId: BigInt(-1).toString(),
message:
'You cannot update user information while a Poll is actively voting.',
},
Expand All @@ -17,7 +17,7 @@ export const updateUserNoNameHandler = [
http.post('/api/updateUser', async () => {
return HttpResponse.json(
{
pollId: BigInt(-1).toString(),
userId: BigInt(-1).toString(),
message: 'Name must be provided.',
},
{ status: 400 },
Expand All @@ -29,7 +29,7 @@ export const updateUserNoEmailHandler = [
http.post('/api/updateUser', async () => {
return HttpResponse.json(
{
pollId: BigInt(-1).toString(),
userId: BigInt(-1).toString(),
message: 'Email must be provided.',
},
{ status: 400 },
Expand All @@ -41,7 +41,7 @@ export const updateUserNoWalletAddressHandler = [
http.post('/api/updateUser', async () => {
return HttpResponse.json(
{
pollId: BigInt(-1).toString(),
userId: BigInt(-1).toString(),
message: 'Wallet address must be provided.',
},
{ status: 400 },
Expand All @@ -53,7 +53,7 @@ export const updateUserTooLongNameHandler = [
http.post('/api/updateUser', async () => {
return HttpResponse.json(
{
pollId: BigInt(-1).toString(),
userId: BigInt(-1).toString(),
message: 'Name must be less than 100 characters.',
},
{ status: 400 },
Expand All @@ -65,7 +65,7 @@ export const updateUserTooLongEmailHandler = [
http.post('/api/updateUser', async () => {
return HttpResponse.json(
{
pollId: BigInt(-1).toString(),
userId: BigInt(-1).toString(),
message: 'Email must be less than 100 characters.',
},
{ status: 400 },
Expand All @@ -77,7 +77,7 @@ export const updateUserTooLongWalletAddressHandler = [
http.post('/api/updateUser', async () => {
return HttpResponse.json(
{
pollId: BigInt(-1).toString(),
userId: BigInt(-1).toString(),
message: 'Wallet Address must be less than 100 characters.',
},
{ status: 400 },
Expand All @@ -89,7 +89,7 @@ export const updateUserInternalErrorHandler = [
http.post('/api/updateUser', async () => {
return HttpResponse.json(
{
pollId: BigInt(-1).toString(),
userId: BigInt(-1).toString(),
message: 'Error updating User Information.',
},
{ status: 500 },
Expand All @@ -101,7 +101,7 @@ export const updateUserInvalidSessionHandler = [
http.post('/api/updateUser', async () => {
return HttpResponse.json(
{
success: false,
userId: BigInt(-1).toString(),
message:
'You must be signed in as an Organizer update user information.',
},
Expand All @@ -114,7 +114,7 @@ export const updateUserNotOrganizerHandler = [
http.post('/api/updateUser', async () => {
return HttpResponse.json(
{
success: false,
userId: BigInt(-1).toString(),
message: 'You must be an Organizer to update user information.',
},
{ status: 401 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ test.skip('alerts user when poll has finished voting', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ test.skip('alerts user when poll ID is not provided', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ test.skip('alerts user when poll is archived', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ test.skip('alerts user when poll is not found', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ test.skip('alerts user when poll is not open for voting yet', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ test.skip('alerts user when poll has finished voting', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ test.skip('alerts user when vote is invalid', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ test.skip('alerts user when vote is not provided', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ test.skip('successfully votes abstain on a poll', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ test.skip('successfully votes no on a poll', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ test.skip('successfully votes yes on a poll', async () => {
id: '1',
stakeAddress: 'stakeAddress',
walletName: 'walletName',
isCoordinator: false,
isDelegate: true,
isAlternate: false,
},
}}
>
<Toaster />
<VoteOnPollButtons
pollName="Test Poll"
pollId="1"
isActiveVoter={true}
hashedText="1dda86a28da3715e618a1605f81c7a3121ce767cdc9bd0d46beec0bef40e8125"
link="https://www.intersectmbo.org/constitution/constitution.html"
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { Toaster } from 'react-hot-toast';
import { expect, test } from 'vitest';

import { ManageRepresentativesTable } from '@/components/coordinator/manageRepresentativesTable';

test('strips whitespace from wallet address', async () => {
const user = userEvent.setup();
render(
<>
<Toaster />
<ManageRepresentativesTable toggleRefresh={() => {}} />
</>,
);

const editButton = await screen.findByTestId('edit-representative-info-1');
await user.click(editButton);

const input = screen.getByDisplayValue('addr1isdufnpoasidjfopmaimdfmopisadj');
await user.clear(input);
await user.type(input, ' coStakeAddress ');

const saveButton = await screen.findByTestId('save-representative-info-1');
await user.click(saveButton);

// Wait for the success toast to appear
const successToast = await screen.findByText('User info updated!');
expect(successToast).toBeDefined();

const newWalletAddress = await screen.findByText('coStakeAddress');
expect(newWalletAddress).toBeDefined();
});
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/cardano.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9724c98

Please sign in to comment.