Skip to content
Open
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
29 changes: 29 additions & 0 deletions .github/workflows/nextjs-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and Test Next.js App

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '18' # Specify the Node.js version you are using

- name: Install Dependencies
run: npm install

- name: Build
run: npm run build

- name: Run Tests
run: npm test

- name: Check Build Output
run: ls .next
59 changes: 46 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,50 @@
## Getting Started
# [Yours.org](http://Yours.org) Mission Statement

**Yours.org: Open-Sourced Bitcoin Technology**

At Yours.org, we believe Bitcoin is the foundation to a brighter future. We are creating decentralized solutions for communication, trade, and data management. Our mission is to facilitate connections directly between individuals, bypassing the need for intermediaries and empowering anyone to use [yours.org](http://yours.org) resources to build Your own products and services. We're dedicated to crafting a platform that is not only secure and transparent but also universally accessible, enhancing development efficiency and fostering stable advancements within the Bitcoin ecosystem. Yours.org is an open-source endeavor, inviting everyone to download, modify, enhance, and contribute, ensuring that everything we do is truly owned by You, the creator.

**Our Vision:**

- To achieve seamless integration of services within the Bitcoin ecosystem, enhancing cross-platform interoperability.
- To create an environment where creatives, developers, and entrepreneurs can thrive and contribute.
- To offer an intuitive products and tooling that welcomes newcomers, allowing them to tap into the vast possibilities Bitcoin offers, irrespective of their investment or pre-conceived idea about what Bitcoin is.
- To ensure all data on Yours.org is securely stored on Bitcoin and retrievable directly from the blockchain, promoting transparency and interoperability.
- To enable direct user interactions, communication, and trading with the innovative use of Bitcoin transactions, eliminating or minimizing the need for third-parties.

**Get Involved:**

First, run the development server:
You can be a part of the Hyperbitcoinization movement by visiting the Yours.org GitHub repository: https://github.com/yours-org/frontend

Together, we can make Bitcoin great again.



## Getting Started

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
**Requirements:**
- package manager, such as npm, yarn, pnpm or bun
- node.js

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
**Run yours.org locally:**
1) Download yours.org zipfile from github and extract.
2) Open filepath in shell or cmd:
```bash
cd /frontend-master
```
4) Run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
5) Wait for start localhost and wait for compile to finish
6) Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
**Edit yours.org:**
- You can start editing the page by modifying `app/page.tsx`.
- The page auto-updates as you edit the file.
36 changes: 36 additions & 0 deletions __tests__/hooks/useEventHandler.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { renderHook } from '@testing-library/react';
import { act } from 'react-dom/test-utils';
import useEventListener from '@/utils/hooks/useEventListener';

describe('useEventListener', () => {
it('calls event handler when specified event is triggered on window', () => {
const handler = jest.fn();
renderHook(() => useEventListener('click', handler));

act(() => {
const event = new Event('click');
window.dispatchEvent(event);
});

expect(handler).toHaveBeenCalled();
expect(handler).toHaveBeenCalledWith(expect.any(Event));
});

it('calls event handler when specified event is triggered on element', () => {
const handler = jest.fn();

// Create a mock element and ref object for the test
const element = document.createElement('div');
const refObject = { current: element };

renderHook(() => useEventListener('click', handler, refObject));

act(() => {
const event = new Event('click');
element.dispatchEvent(event);
});

expect(handler).toHaveBeenCalled();
expect(handler).toHaveBeenCalledWith(expect.any(Event));
});
});
30 changes: 30 additions & 0 deletions __tests__/utils/format-number.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import numberWithCommas from "@/utils/format-number";

describe('numberWithCommas', () => {

// Returns a string with commas separating thousands when given a number greater than or equal to 1000 and less than or equal to 100,000,000.
it('should return a string with commas separating thousands', () => {
// Arrange
const input = 1234567;
const expected = '1,234,567';

// Act
const result = numberWithCommas(input);

// Assert
expect(result).toEqual(expected);
});

// Returns undefined when given a non-numeric value.
it('should return undefined when given a non-numeric value', () => {
// Arrange
const input = 'abc';

// Act
const result = numberWithCommas(input);

// Assert
expect(result).toBeUndefined();
});

})
18 changes: 18 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Config } from 'jest'
import nextJest from 'next/jest.js'

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
})

// Add any custom config to be passed to Jest
const config: Config = {
coverageProvider: 'v8',
testEnvironment: 'jsdom',
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
}

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config)
Loading