Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Licensed under GPL-3.0.

Still a work in progress, but it already lives on the InterPlanetary FileSystem:

- IPNS Hash: `k2k4r8ng8uzrtqb5ham8kao889m8qezu96z4w3lpinyqghum43veb6n3`
- IPNS Name: `k2k4r8ng8uzrtqb5ham8kao889m8qezu96z4w3lpinyqghum43veb6n3`
- [Access through eth.limo](https://nipsys.eth.limo)
- [Access through dweb.link](https://k2k4r8ng8uzrtqb5ham8kao889m8qezu96z4w3lpinyqghum43veb6n3.ipns.dweb.link/)

Expand All @@ -26,8 +26,8 @@ Still a work in progress, but it already lives on the InterPlanetary FileSystem:
- [x] responsive design
- [x] internationalization
- [x] automatic deployment on IPFS
- [_] content is still being written
- [_] pages are still being added & refined
- [] content is still being written
- [] pages are still being added & refined

## commands

Expand Down
5 changes: 0 additions & 5 deletions src/app/__tests__/page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ describe('RootPage', () => {
expect(screen.getByTestId('load-sequence')).toBeInTheDocument();
expect(screen.getByText('LoadSequence Component')).toBeInTheDocument();
});

it('should match snapshot', () => {
const { container } = render(<RootPage />);
expect(container.firstChild).toMatchSnapshot();
});
});
53 changes: 0 additions & 53 deletions src/components/__tests__/LoadSequence.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,6 @@ describe('LoadSequence', () => {
expect(cursor).toHaveClass('animate-pulse');
});

it('should eventually show first step', async () => {
render(<LoadSequence />);

// Wait for the first step to appear
await waitFor(
() => {
expect(
screen.getByText('> Detecting user locale...'),
).toBeInTheDocument();
},
{ timeout: 1000 },
);
});

it('should eventually show locale detection step', async () => {
render(<LoadSequence />);

// Wait for the locale detection step
await waitFor(
() => {
expect(
screen.getByText('> Detecting user locale...'),
).toBeInTheDocument();
},
{ timeout: 2000 },
);
});

it('should detect English locale from browser by default', async () => {
render(<LoadSequence />);

Expand Down Expand Up @@ -169,29 +141,4 @@ describe('LoadSequence', () => {
{ timeout: 3000 },
);
});

it('should handle partial locale codes correctly', async () => {
// Set navigator.language to a specific region code
Object.defineProperty(navigator, 'language', {
writable: true,
value: 'en-GB',
});

render(<LoadSequence />);

// Should still detect as English
await waitFor(
() => {
expect(
screen.getByText('> Selecting proper locale [en]'),
).toBeInTheDocument();
},
{ timeout: 2000 },
);
});

it('should match snapshot', () => {
const { container } = render(<LoadSequence />);
expect(container.firstChild).toMatchSnapshot();
});
});
26 changes: 0 additions & 26 deletions src/components/about-me/__tests__/AboutMe.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,4 @@ describe('AboutMe', () => {

expect(screen.getByText('about me / todo')).toBeInTheDocument();
});

it('should render as a div element', () => {
const { container } = render(<AboutMe />);

expect(container.firstChild).toBeInstanceOf(HTMLDivElement);
});

it('should have the expected content', () => {
const { container } = render(<AboutMe />);

expect(container.firstChild?.textContent).toBe('about me / todo');
});

it('should render without any props', () => {
expect(() => render(<AboutMe />)).not.toThrow();
});

it('should match snapshot', () => {
const { container } = render(<AboutMe />);

expect(container.firstChild).toMatchInlineSnapshot(`
<div>
about me / todo
</div>
`);
});
});
30 changes: 0 additions & 30 deletions src/components/cmd-outputs/__tests__/BuildInfoOutput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,34 +37,4 @@ describe('BuildInfoOutput', () => {
expect(screen.getByText('Build Time:')).toBeInTheDocument();
expect(screen.getByText('IPNS Name:')).toBeInTheDocument();
});

it('displays formatted build timestamp', () => {
render(<BuildInfoOutput t={mockT} entry={mockEntry} />);

// The timestamp should be formatted as a locale string
const buildTimeElement = screen.getByText(/Build Time:/);
expect(buildTimeElement.parentElement).toHaveTextContent('Build Time:');
});

it('displays IPNS hash when configured', () => {
render(<BuildInfoOutput t={mockT} entry={mockEntry} />);

expect(screen.getByText('IPNS Name:')).toBeInTheDocument();
expect(
screen.getByText(
/k51qzi5uqu5dh5kbbff1ucw3ksphpy3vxx4en4dbtfh90pvw4mzd8nfm5r5fnl/,
),
).toBeInTheDocument();
});

it('handles missing environment variables gracefully', () => {
vi.stubGlobal('process', {
env: {},
});

render(<BuildInfoOutput t={mockT} entry={mockEntry} />);

expect(screen.getByText(/Unknown/)).toBeInTheDocument();
expect(screen.getByText(/Not configured/)).toBeInTheDocument();
});
});
9 changes: 0 additions & 9 deletions src/components/cmd-outputs/__tests__/ContactOutput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,8 @@ describe('ContactOutput', () => {
cmdName: Command.Contact,
};

it('renders without crashing', () => {
const { container } = render(<ContactOutput t={mockT} entry={mockEntry} />);
expect(container).toBeInTheDocument();
});

it('renders the Contact component', () => {
render(<ContactOutput t={mockT} entry={mockEntry} />);
expect(screen.getByText('contact / todo')).toBeInTheDocument();
});

it('is a class component that extends Component', () => {
expect(ContactOutput.prototype.render).toBeDefined();
});
});
49 changes: 0 additions & 49 deletions src/components/cmd-outputs/__tests__/HelpOutput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,6 @@ describe('HelpOutput', () => {
vi.clearAllMocks();
});

it('renders without crashing', () => {
const { container } = render(<HelpOutput t={mockT} entry={mockEntry} />);
expect(container.firstChild).toBeInTheDocument();
});

it('renders all commands from Commands constant', () => {
render(<HelpOutput t={mockT} entry={mockEntry} />);

Commands.forEach((cmd) => {
// Check that at least one button with the command name exists
const buttons = screen
.getAllByRole('button')
.filter((button) => button.textContent?.includes(cmd.name));
expect(buttons.length).toBeGreaterThan(0);
});
});

it('calls translation function for command descriptions', () => {
render(<HelpOutput t={mockT} entry={mockEntry} />);

Commands.forEach((cmd) => {
expect(mockT).toHaveBeenCalledWith(`cmds.${cmd.name}.description`);
});
});

it('renders command arguments when they exist', () => {
render(<HelpOutput t={mockT} entry={mockEntry} />);

Expand All @@ -113,28 +88,4 @@ describe('HelpOutput', () => {
expect(mockT).toHaveBeenCalledWith('cmds.test-cmd.argsDesc.arg1');
expect(mockT).toHaveBeenCalledWith('cmds.test-cmd.argsDesc.arg2');
});

it('handles commands without arguments gracefully', () => {
render(<HelpOutput t={mockT} entry={mockEntry} />);

// Commands without arguments should still render their main button
const helpButton = screen.getByTestId('cmd-link-help');
const clearButton = screen.getByTestId('cmd-link-clear');
expect(helpButton).toBeInTheDocument();
expect(clearButton).toBeInTheDocument();
});

it('renders proper typography variants', () => {
render(<HelpOutput t={mockT} entry={mockEntry} />);

const subtitleElements = screen.getAllByTestId('typography-subtitle3');
expect(subtitleElements.length).toBeGreaterThan(0);
});

it('renders with proper CSS classes', () => {
const { container } = render(<HelpOutput t={mockT} entry={mockEntry} />);

const mainDiv = container.firstChild as HTMLElement;
expect(mainDiv).toHaveClass('flex', 'flex-col', 'gap-y-(--lsd-spacing-8)');
});
});
16 changes: 0 additions & 16 deletions src/components/cmd-outputs/__tests__/IntroOutput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ describe('IntroOutput', () => {
vi.clearAllMocks();
});

it('renders without crashing', () => {
const { container } = render(
<IntroOutput t={mockTWithRich} entry={mockEntry} />,
);
expect(container.firstChild).toBeInTheDocument();
});

it('renders welcome message', () => {
render(<IntroOutput t={mockTWithRich} entry={mockEntry} />);
expect(mockTRich).toHaveBeenCalledWith(
Expand Down Expand Up @@ -68,13 +61,4 @@ describe('IntroOutput', () => {
// Check for part of the ASCII art content
expect(asciiDiv).toHaveTextContent('_ __');
});

it('renders with proper CSS classes', () => {
const { container } = render(
<IntroOutput t={mockTWithRich} entry={mockEntry} />,
);

const mainDiv = container.firstChild as HTMLElement;
expect(mainDiv).toHaveClass('flex', 'flex-col');
});
});
21 changes: 0 additions & 21 deletions src/components/cmd-outputs/__tests__/UnknownCmdOutput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ vi.mock('react-icons/pi', () => ({
}));

describe('UnknownCmdOutput', () => {
it('renders without crashing', () => {
const { container } = render(<UnknownCmdOutput cmdName="test" />);
expect(container.firstChild).toBeInTheDocument();
});

it('renders the command name', () => {
const cmdName = 'invalidCommand';
render(<UnknownCmdOutput cmdName={cmdName} />);
Expand All @@ -45,20 +40,4 @@ describe('UnknownCmdOutput', () => {
const icon = screen.getByTestId('nervous-smiley-icon');
expect(icon).toHaveAttribute('data-size', '1.2rem');
});

it('renders with proper CSS classes', () => {
const { container } = render(<UnknownCmdOutput cmdName="test" />);

const mainDiv = container.firstChild as HTMLElement;
expect(mainDiv).toHaveClass('flex', 'items-center', 'gap-x-1');
});

it('displays the full error message format', () => {
const cmdName = 'someCommand';
render(<UnknownCmdOutput cmdName={cmdName} />);

// Check that both the translation key and command name are present
expect(screen.getByText(/unknownCmdErr/)).toBeInTheDocument();
expect(screen.getByText(/someCommand/)).toBeInTheDocument();
});
});
11 changes: 0 additions & 11 deletions src/components/cmd-outputs/__tests__/Web3MissionOutput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,8 @@ describe('Web3MissionOutput', () => {
cmdName: Command.Web3Mission,
};

it('renders without crashing', () => {
const { container } = render(
<Web3MissionOutput t={mockT} entry={mockEntry} />,
);
expect(container).toBeInTheDocument();
});

it('renders the Web3Mission component', () => {
render(<Web3MissionOutput t={mockT} entry={mockEntry} />);
expect(screen.getByText('web3 mission / todo')).toBeInTheDocument();
});

it('is a class component that extends Component', () => {
expect(Web3MissionOutput.prototype.render).toBeDefined();
});
});
9 changes: 0 additions & 9 deletions src/components/cmd-outputs/__tests__/WhoamiOutput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,8 @@ describe('WhoamiOutput', () => {
cmdName: Command.Whoami,
};

it('renders without crashing', () => {
const { container } = render(<WhoamiOutput t={mockT} entry={mockEntry} />);
expect(container).toBeInTheDocument();
});

it('renders the AboutMe component', () => {
render(<WhoamiOutput t={mockT} entry={mockEntry} />);
expect(screen.getByText('about me / todo')).toBeInTheDocument();
});

it('is a class component that extends Component', () => {
expect(WhoamiOutput.prototype.render).toBeDefined();
});
});
28 changes: 1 addition & 27 deletions src/components/common/__tests__/KeyListener.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fireEvent, render } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { KeyListener } from '../KeyListener';

// Mock the AppContext
Expand All @@ -15,32 +15,6 @@ describe('KeyListener', () => {
vi.clearAllMocks();
});

it('renders without crashing', () => {
const { container } = render(<KeyListener />);
expect(container.firstChild).toBeInTheDocument();
});

it('renders with correct CSS classes', () => {
const { container } = render(<KeyListener />);
const div = container.firstChild as HTMLElement;
expect(div).toHaveClass('fixed', '-bottom-5', 'opacity-0');
});

it('has popover manual attribute', () => {
const { container } = render(<KeyListener />);
const div = container.firstChild as HTMLElement;
expect(div).toHaveAttribute('popover', 'manual');
});

it('contains a button with autoFocus', () => {
const { container } = render(<KeyListener />);
const button = container.querySelector('button');
expect(button).toBeInTheDocument();
expect(button).toHaveAttribute('type', 'button');
// autoFocus is a boolean prop that may not appear as an attribute in tests
// so let's just verify the button exists and has correct type
});

it('calls setLastKeyDown on keyDown event', () => {
const { container } = render(<KeyListener />);
const button = container.querySelector('button') as HTMLButtonElement;
Expand Down
Loading