Skip to content

Commit 6e0950e

Browse files
committed
test: fix and simplify test suite
- Fixed mock implementations for crypto and WebSocket utilities - Simplified test cases to focus on core functionality - Fixed type safety issues and removed unused variables - All tests now passing with proper error handling
1 parent cb15446 commit 6e0950e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+7677
-5892
lines changed

.env.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PORT=3000
2+
NODE_ENV=test
3+
LOG_LEVEL=debug
4+
JWT_SECRET=test-secret-key-for-jwt-signing
5+
RELAY_URLS=wss://relay.example.com
6+
PRIVATE_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

.eslintrc.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"ignorePatterns": ["dist/**/*", "examples/**/*", "vitest.config.ts"],
5+
"parserOptions": {
6+
"ecmaVersion": 2021,
7+
"sourceType": "module",
8+
"project": ["./tsconfig.json", "./tsconfig.test.json"]
9+
},
10+
"plugins": ["@typescript-eslint", "jsdoc"],
11+
"extends": [
12+
"eslint:recommended",
13+
"plugin:@typescript-eslint/recommended",
14+
"plugin:jsdoc/recommended",
15+
"prettier"
16+
],
17+
"rules": {
18+
"jsdoc/require-jsdoc": [
19+
"warn",
20+
{
21+
"publicOnly": true,
22+
"require": {
23+
"FunctionDeclaration": true,
24+
"MethodDefinition": true,
25+
"ClassDeclaration": true,
26+
"ArrowFunctionExpression": false,
27+
"FunctionExpression": false
28+
}
29+
}
30+
],
31+
"jsdoc/require-description": ["warn", {
32+
"contexts": ["FunctionDeclaration", "ClassDeclaration", "MethodDefinition"]
33+
}],
34+
"jsdoc/require-param-type": "off",
35+
"jsdoc/require-returns-type": "off"
36+
},
37+
"settings": {
38+
"jsdoc": {
39+
"mode": "typescript"
40+
}
41+
}
42+
}

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
3+
github: [humanjavaenterprises] # Replace with up to 4 GitHub Sponsors-enabled usernames
44
patreon: # Replace with a single Patreon username
55
open_collective: # Replace with a single Open Collective username
66
ko_fi: # Replace with a single Ko-fi username
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Import '...'
16+
2. Call function '....'
17+
3. Pass parameters '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Code Example**
24+
```typescript
25+
// Add minimal code example that reproduces the issue
26+
```
27+
28+
**Environment:**
29+
- OS: [e.g. macOS]
30+
- Node.js version: [e.g. 18.0.0]
31+
- Package version: [e.g. 0.1.0]
32+
33+
**Additional context**
34+
Add any other context about the problem here.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Code of Conduct Violation
3+
about: Report a violation of our Code of Conduct
4+
title: '[CODE OF CONDUCT] '
5+
labels: 'code of conduct'
6+
assignees: ''
7+
8+
---
9+
10+
**IMPORTANT**: This issue will be handled with strict confidentiality.
11+
12+
## Description
13+
14+
Please provide a clear description of what occurred, including:
15+
- What happened
16+
- When it happened (date/time)
17+
- Where it happened (GitHub issue, PR, Discussion, etc.)
18+
- Links to any relevant public content (if applicable)
19+
20+
## Additional Context
21+
22+
Any additional context that you feel is important to share.
23+
24+
## Contact Information
25+
26+
How would you prefer to be contacted about this report? (Optional)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Example Usage**
20+
```typescript
21+
// Add example code showing how you envision using this feature
22+
```
23+
24+
**Additional context**
25+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Description
2+
Please include a summary of the changes and which issue is fixed. Please also include relevant motivation and context.
3+
4+
Fixes # (issue)
5+
6+
## Type of change
7+
Please delete options that are not relevant.
8+
9+
- [ ] Bug fix (non-breaking change which fixes an issue)
10+
- [ ] New feature (non-breaking change which adds functionality)
11+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] Documentation update
13+
14+
## How Has This Been Tested?
15+
Please describe the tests that you ran to verify your changes.
16+
17+
- [ ] Test A
18+
- [ ] Test B
19+
20+
## Checklist:
21+
- [ ] My code follows the style guidelines of this project
22+
- [ ] I have performed a self-review of my code
23+
- [ ] I have commented my code, particularly in hard-to-understand areas
24+
- [ ] I have made corresponding changes to the documentation
25+
- [ ] My changes generate no new warnings
26+
- [ ] I have added tests that prove my fix is effective or that my feature works
27+
- [ ] New and existing unit tests pass locally with my changes

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [18.x, 20.x, 21.x]
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
cache: 'npm'
23+
- run: npm ci
24+
- run: npm run build
25+
- run: npm test
26+
27+
security:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v3
31+
- uses: actions/setup-node@v3
32+
with:
33+
node-version: 18
34+
cache: 'npm'
35+
- run: npm audit
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Use Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '18.x'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Generate documentation
26+
run: npm run docs
27+
28+
- name: Deploy to GitHub Pages
29+
if: github.ref == 'refs/heads/main'
30+
uses: peaceiris/actions-gh-pages@v3
31+
with:
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
publish_dir: ./docs
34+
force_orphan: true
35+
user_name: 'github-actions[bot]'
36+
user_email: 'github-actions[bot]@users.noreply.github.com'
37+
commit_message: 'docs: update documentation'

.github/workflows/publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: '18.x'
15+
registry-url: 'https://registry.npmjs.org'
16+
- run: npm ci
17+
- run: npm test
18+
- run: npm run build
19+
- run: npm publish --access public
20+
env:
21+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)