Skip to content

Commit

Permalink
feat(test enhancements): enhance
Browse files Browse the repository at this point in the history
  • Loading branch information
cgilbe27 committed Oct 11, 2023
1 parent 11c9782 commit c130a83
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 80 deletions.
49 changes: 0 additions & 49 deletions .github/workflows/test-indexer-nibi.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ⛓️ Tests @nibiruchain/nibijs
name: ⛓️ Tests @nibiruchain/ts-sdk

on:
pull_request:
Expand All @@ -12,38 +12,45 @@ jobs:
test-nibijs:
runs-on: ubuntu-latest
env:
CHAIN_HOST: ${{ secrets.CHAIN_HOST }}
VALIDATOR_MNEMONIC: ${{ secrets.VALIDATOR_MNEMONIC }}
VALIDATOR_ADDRESS: ${{ secrets.VALIDATOR_ADDRESS }}
LCD_ENDPOINT: "http://127.0.0.1:1317"
GRPC_ENDPOINT: "127.0.0.1:9090"
TENDERMINT_RPC_ENDPOINT: "http://127.0.0.1:26657"
USE_LOCALNET: true
WEBSOCKET_ENDPOINT: "ws://127.0.0.1:26657/websocket"
CHAIN_ID: "nibiru-localnet-0"
VALIDATOR_MNEMONIC: "guard cream sadness conduct invite crumble clock pudding hole grit liar hotel maid produce squeeze return argue turtle know drive eight casino maze host"
# VALIDATOR_MNEMONIC: "guard cream sadness conduct invite crumble clock pudding hole grit liar hotel maid produce squeeze return argue turtle know drive eight casino maze host"
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Install nibid
run: curl -s https://get.nibiru.fi/@v0.21.9! | bash
# Use https://get.nibiru.fi/ to get the most recent release.

- name: Check nibid version
run: nibid version

- name: Run localnet.sh in the background
run: |
sh scripts/localnet.sh &
- name: Setup NodeJS and npm
uses: actions/setup-node@v3
with:
node-version: "lts/hydrogen"
- name: Install yarn using npm
run: npm install -g yarn
- name: Setup NodeJS with yarn caching
uses: actions/setup-node@v3
with:
node-version: "lts/hydrogen"
cache: "yarn"

- name: Install yarn using npm
run: npm install -g yarn

- name: Install dependencies
run: yarn --prefer-offline --check-files

- name: Build the application
run: yarn build --include-dependencies || yarn build --parallel --include-dependencies
- name: Run tests - nibijs
run: yarn test:nibijs

- name: Run tests
run: yarn test
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 @NibiruChain
Copyright (c) @NibiruChain

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
17 changes: 9 additions & 8 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,25 @@ module.exports = function (root = __dirname) {
// clearMocks: false,

// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: true,
collectCoverage: true,

// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: null,
collectCoverageFrom: [
"packages/indexer-nibi/src/**/*.{js,jsx,ts,tsx}",
"packages/nibijs/src/**/*.{js,jsx,ts,tsx}",
"!**/node_modules/**",
"!**/dist/**",
],

// The directory where Jest should output its coverage files
// coverageDirectory: null,

// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: [
"/node_modules/",
"<rootDir>/dist/",
"protojs/dist/",
],
coveragePathIgnorePatterns: ["/node_modules/", "/dist/"],

// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: ['json', 'html', 'lcov', 'text'],
coverageReporters: ["json", "text"],
coverageReporters: ["json", "text", "html"],

// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: null,
Expand Down
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
"clean": "lerna run --parallel clean",
"commit": "cz",
"publish:all": "lerna publish from-package",
"test": "jest",
"test:short": "jest --testPathIgnorePatterns faucet.test.ts",
"test:nibijs": "yarn test --verbose --coverage --testPathPattern=packages/nibijs --testPathIgnorePatterns faucet.test.ts",
"test:indexer-nibi": "yarn test --verbose --coverage --testPathPattern=packages/indexer-nibi",
"coverage": "jest --coverage",
"test": "jest --verbose",
"lint": "eslint -c './.eslintrc.js' './packages/**/*.{ts,js}'",
"lint:ci": "yarn lint . --format junit",
"lint:md": "markdownlint --ignore node_modules --ignore .git",
Expand Down
24 changes: 18 additions & 6 deletions packages/indexer-nibi/src/node-test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { HeartMonitor } from "./heart-monitor"

;(async () => {
const hm = new HeartMonitor()
const nibiruUrl = "itn-3"
const hm = new HeartMonitor(
{
endptTm: `https://hm-graphql.${nibiruUrl}.nibiru.fi`,
},
`wss://hm-graphql.itn-3.nibiru.fi/query`
)
const test = await hm.markPriceCandlesSubscription({})
if (test) {
for await (const event of test) {
console.log(event)
try {
if (test) {
console.log(await test.next())
for await (const event of test) {
console.log(event)

// complete a running subscription by breaking the iterator loop
// break
// complete a running subscription by breaking the iterator loop
// break
}
}
} catch (e) {
console.log(e)
}
})()
2 changes: 1 addition & 1 deletion packages/nibijs/docs/classes/StableSwap.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ y()
Calculate x[j] if one makes x[i] = x

Done by solving quadratic equation iteratively.
x*1**2 + x1 * (sum' - (A*n**n - 1) * D / (A _ n**n)) = D ** (n+1)/(n \*\* (2 _ n) \_ prod' \* A)
x*1\*\*2 + x1 * (sum' - (A*n\*\*n - 1) * D / (A _ n**n)) = D ** (n+1)/(n \*\* (2 _ n) \_ prod' \* A)
x_1\*\*2 + b\*x_1 = c

x_1 = (x_1\**2 + c) / (2*x_1 + b)
Expand Down

0 comments on commit c130a83

Please sign in to comment.