Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
feat: welcome -> create profile routing (#2328)
Browse files Browse the repository at this point in the history
  • Loading branch information
clucasalcantara committed Jul 2, 2020
1 parent c8dbaba commit a8446f1
Show file tree
Hide file tree
Showing 23 changed files with 248 additions and 68 deletions.
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"baseUrl": "http://localhost:3000",
"defaultCommandTimeout": 8000,
"video": false
"video": false,
"screenshot": false
}
9 changes: 9 additions & 0 deletions cypress/integration/welcome-routing.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe("Welcome -> Create Profile routing", () => {
it("should navigate between welcome and create profile", () => {
cy.visit("/");

cy.get("button").contains("Create Profile").click();
cy.get("button").contains("Back").click();
cy.get("h1").should("have.text", "Welcome to ARK");
});
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
"eslint-plugin-simple-import-sort": "^5.0.3",
"eslint-plugin-testing-library": "^3.2.0",
"eslint-plugin-unused-imports": "^0.1.3",
"history": "^5.0.0",
"husky": "^4.2.5",
"jest-fetch-mock": "^3.0.3",
"lint-staged": "^10.2.7",
Expand Down
13 changes: 12 additions & 1 deletion src/app/components/Card/Card.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { render } from "test-utils";
import { fireEvent, render } from "test-utils";

import { Card } from "./Card";

Expand All @@ -10,4 +10,15 @@ describe("Card", () => {
expect(container).toBeTruthy();
expect(asFragment()).toMatchSnapshot();
});

it("should handle click", () => {
const handleClick = jest.fn();
const { container, asFragment, getByText } = render(<Card handleClick={() => handleClick()}>Test</Card>);

expect(container).toBeTruthy();
fireEvent.click(getByText("Test"));

expect(handleClick).toHaveBeenCalled();
expect(asFragment()).toMatchSnapshot();
});
});
11 changes: 10 additions & 1 deletion src/app/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ import tw, { styled } from "twin.macro";
type CardProps = {
as?: React.ElementType;
children: React.ReactNode;
handleClick?: any;
className?: string;
};

export const Card = styled.div<CardProps>`
const Wrapper = styled.div`
${tw`p-6 border-2 border-theme-primary-contrast rounded-lg`}
cursor: pointer;
`;

export const Card = ({ handleClick, children, className }: CardProps) => (
<Wrapper className={className} onClick={() => handleClick()}>
{children}
</Wrapper>
);
12 changes: 11 additions & 1 deletion src/app/components/Card/__snapshots__/Card.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Card should handle click 1`] = `
<DocumentFragment>
<div
class="sc-AxjAm eWJHeF"
>
Test
</div>
</DocumentFragment>
`;

exports[`Card should render 1`] = `
<DocumentFragment>
<div
class="sc-AxjAm hQFgsK"
class="sc-AxjAm eWJHeF"
/>
</DocumentFragment>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`Card Control should render 1`] = `
value=""
/>
<div
class="sc-AxirZ CardControl__CustomCard-sc-28luv0-1 hbehcc"
class="sc-AxirZ PHAyy CardControl__CustomCard-sc-28luv0-1 dojmPD"
/>
</label>
</DocumentFragment>
Expand All @@ -30,7 +30,7 @@ exports[`Card Control should render with a control state 1`] = `
value=""
/>
<div
class="sc-AxirZ CardControl__CustomCard-sc-28luv0-1 hbehcc"
class="sc-AxirZ PHAyy CardControl__CustomCard-sc-28luv0-1 dojmPD"
>
<div
class="flex flex-col items-center justify-between h-full"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`Formatted Address should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxjAm hQFgsK"
class="sc-AxjAm eWJHeF"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -62,7 +62,7 @@ exports[`Formatted Address should render blank 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxjAm hQFgsK"
class="sc-AxjAm eWJHeF"
>
<div
class="p-2"
Expand Down Expand Up @@ -97,7 +97,7 @@ exports[`Formatted Address should render with wallet data 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxjAm hQFgsK"
class="sc-AxjAm eWJHeF"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -182,7 +182,7 @@ exports[`Formatted Address should render with wallet data and optional icon 1`]
class="w-64 inline-block undefined"
>
<div
class="sc-AxjAm hQFgsK"
class="sc-AxjAm eWJHeF"
>
<div
class="relative p-2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -286,7 +286,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -411,7 +411,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -536,7 +536,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -661,7 +661,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -786,7 +786,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -911,7 +911,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -1036,7 +1036,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="p-2"
Expand Down Expand Up @@ -1071,7 +1071,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -1196,7 +1196,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -1321,7 +1321,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -1446,7 +1446,7 @@ exports[`Wallets should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="relative p-2"
Expand Down Expand Up @@ -1741,7 +1741,7 @@ exports[`Wallets should render with empty wallets list 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="p-2"
Expand Down Expand Up @@ -1776,7 +1776,7 @@ exports[`Wallets should render with empty wallets list 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="p-2"
Expand Down Expand Up @@ -1811,7 +1811,7 @@ exports[`Wallets should render with empty wallets list 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="p-2"
Expand Down Expand Up @@ -1846,7 +1846,7 @@ exports[`Wallets should render with empty wallets list 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxhCb jxpqWJ"
class="sc-AxhCb iaJYea"
>
<div
class="p-2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ exports[`Dashboard should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -200,7 +200,7 @@ exports[`Dashboard should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -235,7 +235,7 @@ exports[`Dashboard should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -270,7 +270,7 @@ exports[`Dashboard should render 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -704,7 +704,7 @@ exports[`Dashboard should render portfolio chart 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -739,7 +739,7 @@ exports[`Dashboard should render portfolio chart 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -774,7 +774,7 @@ exports[`Dashboard should render portfolio chart 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -809,7 +809,7 @@ exports[`Dashboard should render portfolio chart 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -1039,7 +1039,7 @@ exports[`Dashboard should render portfolio percentage bar 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -1074,7 +1074,7 @@ exports[`Dashboard should render portfolio percentage bar 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -1109,7 +1109,7 @@ exports[`Dashboard should render portfolio percentage bar 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down Expand Up @@ -1144,7 +1144,7 @@ exports[`Dashboard should render portfolio percentage bar 1`] = `
class="w-64 inline-block undefined"
>
<div
class="sc-AxheI euRuZs"
class="sc-AxheI jQWqsv"
>
<div
class="p-2"
Expand Down
Loading

0 comments on commit a8446f1

Please sign in to comment.