Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
shaes-farm committed Aug 12, 2023
2 parents d60ed23 + 105955a commit 852f10d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 56 deletions.
32 changes: 16 additions & 16 deletions src/components/Nav/__tests__/Nav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ describe('Nav component', () => {

routes = {
primary: [{
slug: chance.string(),
slug: faker.lorem.slug(),
icon: <React.Fragment />,
label: chance.string(),
label: faker.lorem.words(),
page: <React.Fragment />,
},{
slug: chance.string(),
slug: faker.lorem.slug(),
icon: <React.Fragment />,
label: chance.string(),
label: faker.lorem.words(),
page: <React.Fragment />,
}],
secondary: [{
slug: chance.string(),
slug: faker.lorem.slug(),
icon: <React.Fragment />,
label: chance.string(),
label: faker.lorem.words(),
page: <React.Fragment />,
},{
slug: chance.string(),
slug: faker.lorem.slug(),
icon: <React.Fragment />,
label: chance.string(),
label: faker.lorem.words(),
page: <React.Fragment />,
}],
tertiary: [{
slug: chance.string(),
slug: faker.lorem.slug(),
icon: <React.Fragment />,
label: chance.string(),
label: faker.lorem.words(),
page: <React.Fragment />,
}]
};
Expand Down Expand Up @@ -103,21 +103,21 @@ describe('Nav component', () => {

it('should render a Nav with sub-headers', () => {
routes.primary.push({
slug: 'header-' + chance.string(),
slug: `header-${faker.lorem.slug()}`,
icon: <React.Fragment />,
label: chance.string(),
label: faker.lorem.words(),
page: <React.Fragment />,
});
routes.secondary?.push({
slug: 'header-' + chance.string(),
slug: `header-${faker.lorem.slug()}`,
icon: <React.Fragment />,
label: chance.string(),
label: faker.lorem.words(),
page: <React.Fragment />,
});
routes.tertiary?.push({
slug: 'header-' + chance.string(),
slug: `header-${faker.lorem.slug()}`,
icon: <React.Fragment />,
label: chance.string(),
label: faker.lorem.words(),
page: <React.Fragment />,
});

Expand Down
12 changes: 6 additions & 6 deletions src/providers/Profile/__tests__/Profile.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ describe('Profile context provider', () => {

beforeAll(() => {
profile = {
id: chance.guid(),
firstName: chance.first(),
lastName: chance.last(),
bio: chance.paragraph(),
avatarUrl: 'https://via.placeholder.com/46',
website: chance.url(),
id: faker.string.uuid(),
firstName: faker.person.firstName(),
lastName: faker.person.lastName(),
bio: faker.person.bio(),
avatarUrl: faker.image.url({width: 48, height: 48}),
website: faker.internet.url(),
loading: false,
};

Expand Down
28 changes: 13 additions & 15 deletions src/stories/Auth.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useState} from "react";
import {useParameter} from "@storybook/addons";
import type {Meta, StoryObj} from '@storybook/react';
import {Chance} from 'chance';
import {faker} from '@faker-js/faker';
import AccountBalanceIcon from '@mui/icons-material/AccountBalance';
import AllInclusiveIcon from '@mui/icons-material/AllInclusive';
import BlindIcon from '@mui/icons-material/Blind';
Expand All @@ -10,8 +10,6 @@ import {Auth} from '../components';
import type {Credentials, SignUpInfo, RecoverPasswordInfo} from '../components';
import {Profile, ProfileProvider} from "../providers";

const chance = new Chance(new Chance().natural());

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
const meta: Meta<typeof Auth> = {
title: 'Mui-Mas/Auth',
Expand All @@ -25,12 +23,12 @@ const meta: Meta<typeof Auth> = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(Story, context) => {
const initialState: Profile | undefined = useParameter('profile', {
id: chance.guid(),
firstName: chance.first(),
lastName: chance.last(),
bio: chance.paragraph(),
avatarUrl: chance.url(),
website: chance.url(),
id: faker.string.uuid(),
firstName: faker.person.firstName(),
lastName: faker.person.lastName(),
bio: faker.person.bio(),
avatarUrl: faker.image.url(),
website: faker.internet.url(),
loading: false,
});

Expand Down Expand Up @@ -58,8 +56,8 @@ export const SignIn: Story = {
args: {
type: 'password',
icon: <AccountBalanceIcon />,
title: chance.string(),
subTitle: `${chance.capitalize(chance.word())} ${chance.capitalize(chance.word())}`,
title: faker.lorem.words(),
subTitle: faker.lorem.words(),
signInUrl: '/signin',
signIn,
signUpUrl: '/signup',
Expand All @@ -73,8 +71,8 @@ export const SignUp: Story = {
args: {
type: 'signup',
icon: <AllInclusiveIcon />,
title: chance.string(),
subTitle: `${chance.capitalize(chance.word())} ${chance.capitalize(chance.word())}`,
title: faker.lorem.words(),
subTitle: faker.lorem.words(),
signInUrl: '/signin',
signIn,
signUpUrl: '/signup',
Expand All @@ -88,8 +86,8 @@ export const RecoverPassword: Story = {
args: {
type: 'recover',
icon: <BlindIcon />,
title: chance.string(),
subTitle: `${chance.capitalize(chance.word())} ${chance.capitalize(chance.word())}`,
title: faker.lorem.words(),
subTitle: faker.lorem.words(),
signInUrl: '/signin',
signIn,
signUpUrl: '/signup',
Expand Down
32 changes: 15 additions & 17 deletions src/stories/AuthShell.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React, {useState} from "react";
import {useParameter} from "@storybook/addons";
import type {Meta, StoryObj} from '@storybook/react';
import {Chance} from 'chance';
import {faker} from '@faker-js/faker';

import {AuthShell} from '../components';
import type {Credentials, SignUpInfo, RecoverPasswordInfo} from '../components';
import {Profile, ProfileProvider} from "../providers";

const chance = new Chance(new Chance().natural());

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
const meta: Meta<typeof AuthShell> = {
title: 'Mui-Mas/AuthShell',
Expand All @@ -22,12 +20,12 @@ const meta: Meta<typeof AuthShell> = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(Story, context) => {
const initialState: Profile | undefined = useParameter('profile', {
id: chance.guid(),
firstName: chance.first(),
lastName: chance.last(),
bio: chance.paragraph(),
avatarUrl: chance.url(),
website: chance.url(),
id: faker.string.uuid(),
firstName: faker.person.firstName(),
lastName: faker.person.lastName(),
bio: faker.person.bio(),
avatarUrl: faker.image.url(),
website: faker.internet.url(),
loading: false,
});

Expand All @@ -48,17 +46,17 @@ type Story = StoryObj<typeof AuthShell>;

const config = {
app: {
title: `${chance.capitalize(chance.word())} ${chance.capitalize(chance.word())}`,
description: chance.paragraph(),
icon: 'https://placehold.co/64',
title: faker.lorem.words(),
description: faker.lorem.paragraph(),
icon: faker.image.url({width: 48, height: 48}),
logo: {
main: 'https://placehold.co/46',
contrast: 'https://placehold.co/46',
main: faker.image.url({width: 48, height: 48}),
contrast: faker.image.url({width: 48, height: 48}),
},
copyright: {
holder: chance.name(),
year: Number(chance.year({min: 1995, max: new Date().getFullYear()})),
url: chance.url(),
holder: faker.person.fullName(),
year: faker.date.past({years: 3}).getFullYear(),
url: faker.internet.url(),
},
pages: {
home: '/',
Expand Down
File renamed without changes.
15 changes: 13 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/test-utils/test-setup.d.ts"],
"exclude": ["node_modules", "build", "scripts", "jest", "examples"]
"include": [
"test-setup.d.ts",
"src/**/*.ts",
"src/**/*.tsx"
],
"exclude": [
"node_modules",
"build",
"scripts",
"jest",
"coverage",
"example"
]
}

0 comments on commit 852f10d

Please sign in to comment.