Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc committed Feb 6, 2024
1 parent 108bf21 commit 22de8ff
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ describe("<Github />", () => {
store
);
});

// console.log(screen.debug());
// TO BE ENABLE
// should not be a problem with REACT_APP_PASSPORT_IAM_URL properly set
// expect(screen.queryByText("Verified")).toBeInTheDocument();
});

test("should not show the badge if the verified account is different from the current one in the form", async () => {
Expand Down
23 changes: 12 additions & 11 deletions packages/builder/src/__tests__/components/rounds/Show.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
addressFrom,
buildProjectMetadata,
buildRound,
now,
renderWrapped,
} from "../../../utils/test_utils";

Expand Down Expand Up @@ -42,19 +43,19 @@ describe("<Show />", () => {
});

const pastRound = buildRound({
address: addressFrom(1),
applicationsStartTime: new Date(Date.now() - 60 * 60),
applicationsEndTime: new Date(Date.now() - 10 * 60),
roundStartTime: new Date(Date.now() - 60 * 60),
roundEndTime: new Date(Date.now() - 10 * 60),
address: addressFrom(2),
applicationsStartTime: now - 7200,
applicationsEndTime: now - 3600,
roundStartTime: now - 3600,
roundEndTime: now - 600,
});

const futureRound = buildRound({
address: addressFrom(1),
applicationsStartTime: new Date(Date.now() + 60 * 30),
applicationsEndTime: new Date(Date.now() + 60 * 60),
roundStartTime: new Date(Date.now() + 60 * 60),
roundEndTime: new Date(Date.now() + 60 * 120),
address: addressFrom(3),
applicationsStartTime: now + 3600,
applicationsEndTime: now + 7200,
roundStartTime: now + 7200,
roundEndTime: now + 12000,
});

store.dispatch(web3ChainIDLoaded(5));
Expand Down Expand Up @@ -179,7 +180,7 @@ describe("<Show />", () => {
expect(screen.getByText("Apply")).toBeInTheDocument();
});

test.only("should send you to project creation page", async () => {
test("should send you to project creation page", async () => {
(loadRound as jest.Mock).mockReturnValue({ type: "TEST" });
(unloadRounds as jest.Mock).mockReturnValue({ type: "TEST" });
(loadProjects as jest.Mock).mockReturnValue({ type: "TEST" });
Expand Down
4 changes: 4 additions & 0 deletions packages/builder/src/components/grants/ApplicationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ export default function ApplicationCard({
applicationData.application.inReview ||
applicationData.application.status === "APPROVED";

if (!props.round?.roundMetadata) {
return null;
}

return (
<Box
p={2}
Expand Down
14 changes: 5 additions & 9 deletions packages/builder/src/components/rounds/Show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function ShowRound() {
const web3ChainId = state.web3.chainID;
const roundChainId = Number(chainId);

const now = new Date();
const now = new Date().getTime() / 1000;

let applicationsHaveStarted = false;
let applicationsHaveEnded = false;
Expand All @@ -149,18 +149,16 @@ function ShowRound() {
roundState?.round?.applicationsStartTime !== undefined &&
roundState?.round?.roundStartTime !== undefined
) {
applicationsHaveStarted =
new Date(roundState.round?.applicationsStartTime) <= now;
votingHasStarted = new Date(roundState.round?.roundStartTime) <= now;
applicationsHaveStarted = roundState.round?.applicationsStartTime <= now;
votingHasStarted = roundState.round?.roundStartTime <= now;
}
if (
roundState?.round &&
roundState?.round?.applicationsEndTime !== undefined &&
roundState?.round?.roundEndTime !== undefined
) {
applicationsHaveEnded =
new Date(roundState.round?.applicationsEndTime) <= now;
votingHasEnded = new Date(roundState.round?.roundEndTime) <= now;
applicationsHaveEnded = roundState.round?.applicationsEndTime <= now;
votingHasEnded = roundState.round?.roundEndTime <= now;
}

return {
Expand Down Expand Up @@ -209,8 +207,6 @@ function ShowRound() {

const isOnRoundChain = props.web3ChainId === props.roundChainId;

console.log("props", props);

useEffect(() => {
if (!isOnRoundChain) return;

Expand Down
3 changes: 0 additions & 3 deletions packages/builder/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,4 @@ root.render(
</ErrorBoundary>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
10 changes: 6 additions & 4 deletions packages/builder/src/utils/test_utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ export const buildAlert = (attrs = {}): Alert => ({
...attrs,
});

export const now = new Date().getTime() / 1000;

export const buildRound = (round: any): Round => ({
address: addressFrom(1),
applicationsStartTime: new Date(1663751953000),
applicationsEndTime: new Date(Date.now() + 36000000),
roundStartTime: new Date(1663751953000),
roundEndTime: new Date(Date.now() + 36000000),
applicationsStartTime: now,
applicationsEndTime: now + 3600,
roundStartTime: now + 3600,
roundEndTime: now + 7200,
token: "0x0000000000000000000000000000000000000000",
roundMetaPtr: {},
roundMetadata: {},
Expand Down

0 comments on commit 22de8ff

Please sign in to comment.