Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
21c98a4
Create dependabot.yml
Sam-Rowe May 31, 2025
b466041
add extended test coverage for hexagram and trigram classes
Sam-Rowe May 31, 2025
e99b975
add tests for hexagram and trigram consistency
Sam-Rowe May 31, 2025
888cfeb
Pre-conservative-upgrade checkpoint
Sam-Rowe May 31, 2025
3f5a761
Conservative upgrade: lodash → 4.17.21
Sam-Rowe May 31, 2025
ee5b345
Conservative upgrade: seedrandom → 3.0.5
Sam-Rowe May 31, 2025
f9c3e6b
feat: migrate testing framework from Mocha/Expect to Jest
Sam-Rowe May 31, 2025
e2365ea
Updated readme and version info in package.json
Sam-Rowe May 31, 2025
56d9c6a
Add note about GH CP Aid
Sam-Rowe May 31, 2025
645af43
Added status badge to the README and github actions CI action
Sam-Rowe May 31, 2025
eeb6153
fix: update CI badge link in README
Sam-Rowe May 31, 2025
473c454
Bump jest from 29.7.0 to 30.0.2
dependabot[bot] Jun 23, 2025
b0aadd0
Update ci.yml
Sam-Rowe Jun 23, 2025
2c22b0f
Merge pull request #5 from Sam-Rowe/dependabot/npm_and_yarn/jest-30.0.2
Sam-Rowe Jun 23, 2025
e38e5a2
Bump jest from 30.0.2 to 30.0.4
dependabot[bot] Jul 7, 2025
9237480
Merge pull request #7 from Sam-Rowe/dependabot/npm_and_yarn/jest-30.0.4
Sam-Rowe Jul 25, 2025
d5e3e21
Bump jest from 30.0.4 to 30.2.0
dependabot[bot] Sep 29, 2025
09c1123
Bump js-yaml in the npm_and_yarn group across 1 directory
dependabot[bot] Nov 18, 2025
5fccbe3
Merge pull request #11 from Sam-Rowe/dependabot/npm_and_yarn/npm_and_…
Sam-Rowe Dec 30, 2025
16cbb0a
Merge pull request #10 from Sam-Rowe/dependabot/npm_and_yarn/jest-30.2.0
Sam-Rowe Dec 30, 2025
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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
push:
branches:
- '**'
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x, 22.x, 24.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Run tests with coverage
run: npm run test:coverage

- name: Upload coverage to Codecov
if: matrix.node-version == '20.x'
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,16 @@ npm test

# Change Log

##### Version 0.3.6

Aided by GitHub Copilot
* Added additional tests and test coverage
* Updated loadash to latest stable ^4.17.21
* Updated seedrandom to latested stable ^3.0.5
* Updated tests to run on jest ^29.7.0 (from old version of Mocha)
* Removed expect and using in built Jest in tests


##### Version 0.3.3

* Added `Trigram.hexagrams(position)` method.
Expand Down Expand Up @@ -802,6 +812,10 @@ npm test

* initial release

## Status

[![CI](https://github.com/sam-rowe/i-ching/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sam-rowe/i-ching/actions/workflows/ci.yml)

# <a name="references"></a>References

* [Wilhelm, R. & Baynes, C. (1967). The I ching; or, Book of changes. Princeton, N.J: Princeton University Press](https://www.amazon.com/Ching-Changes-Bollingen-Princeton-University/dp/069109750X) (amazon.com).
Expand Down
43 changes: 43 additions & 0 deletions debug-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const iChing = require('./lib/i-ching.js');
const data = require('./lib/data.json');

console.log('=== Testing Data Consistency ===');
// Check if binary matches lines for first few hexagrams
for (let i = 0; i < 5; i++) {
const hex = data.hexagrams[i];
const linesJoined = hex.lines.join('');
console.log(`H${hex.number}: binary=${hex.binary}, lines=${linesJoined}, match=${hex.binary === linesJoined}`);
}

console.log('\n=== Testing changeLines ===');
const h1 = iChing.hexagram(1);
console.log('H1 lines:', h1.lines);
console.log('H1 binary:', h1.binary);

try {
// Test with invalid values
h1.changeLines([1,0,2,0,1,0]);
console.log('ERROR: Should have thrown for invalid line value 2');
} catch(e) {
console.log('Correctly threw error for invalid line value:', e.message);
}

try {
const change = h1.changeLines([1,0,0,0,0,0]);
console.log('Change result:', {
binary: change.binary,
toBinary: change.to.binary,
toNumber: change.to.number
});
} catch(e) {
console.log('Error in changeLines:', e.message);
}

console.log('\n=== Testing Trigram Position Validation ===');
const t1 = iChing.trigram(1);
try {
t1.hexagrams('invalid');
console.log('ERROR: Should have thrown for invalid position');
} catch(e) {
console.log('Correctly threw error for invalid position:', e.message);
}
Loading