Skip to content
This repository was archived by the owner on Feb 27, 2025. It is now read-only.

Commit b8f1bef

Browse files
committed
package json error modified, tests modified
1 parent dc389cb commit b8f1bef

32 files changed

+8127
-5761
lines changed

package-lock.json

Lines changed: 1427 additions & 102 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77
"lerna-publish-beta": "lerna publish --no-private --conventional-commits from-git --dist-tag beta"
88
},
99
"devDependencies": {
10-
"@tsconfig/recommended": "^1.0.1"
10+
"@tsconfig/recommended": "^1.0.1",
11+
"raf": "^3.4.1"
1112
},
1213
"dependencies": {
13-
"lerna": "^6.4.0"
14+
"-": "^0.0.1",
15+
"@types/node": "^20.3.1",
16+
"lerna": "^6.4.0",
17+
"raf-polyfill": "^1.0.0",
18+
"save-dev": "^0.0.1-security",
19+
"typescript": "^5.1.3"
1420
},
1521
"workspaces": [
1622
"packages/*"

packages/chains/jest.setup.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const { JSDOM } = require('jsdom')
2+
const React = require('react')
3+
const { useContext } = require('react')
4+
const { render } = require('react-dom')
5+
const { renderHook } = require('@testing-library/react-hooks')
6+
require('raf/polyfill')
7+
8+
const jsdom = new JSDOM('<!doctype html><html><body></body></html>')
9+
10+
global.window = jsdom.window
11+
global.document = jsdom.window.document
12+
global.navigator = {
13+
userAgent: 'node.js',
14+
}
15+
global.React = React
16+
global.useContext = useContext
17+
global.render = render
18+
global.renderHook = renderHook

packages/chains/package.json

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,37 @@
88
"repository": "github:esteblock/soroban-react",
99
"version": "5.0.3",
1010
"scripts": {
11-
"prebuild": "rm -rf dist",
12-
"build": "tsc",
13-
"start": "tsc --watch"
11+
"prebuild": "del /s /q dist",
12+
"prebuild-linux": "rd -rf dist",
13+
"build": "yarn prebuild && tsc",
14+
"prepare": "install-peers",
15+
"start": "tsc --watch",
16+
"test": "yarn prepare && yarn build && yarn jest"
1417
},
1518
"main": "dist/index.js",
1619
"exports": "./dist/index.js",
1720
"types": "dist/index.d.ts",
1821
"files": [
1922
"/dist"
2023
],
24+
"jest": {
25+
"setupFilesAfterEnv": [
26+
"./jest.setup.js"
27+
],
28+
"collectCoverage": true
29+
},
2130
"dependencies": {
2231
"@soroban-react/types": "^5.0.3",
2332
"soroban-client": "0.8.0"
33+
},
34+
"devDependencies": {
35+
"@types/jest": "^29.5.2",
36+
"install-peers-cli": "^2.2.0",
37+
"jest": "^29.5.0",
38+
"jsdom": "^22.1.0",
39+
"ts-jest": "^29.1.0"
40+
},
41+
"peerDependencies": {
42+
"react": "^17.0.2"
2443
}
2544
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const {
2+
public_chain,
3+
futurenet,
4+
testnet,
5+
sandbox,
6+
standalone,
7+
} = require('../dist/index.js')
8+
9+
const PUBLIC_PASSPHRASE = 'Public Global Stellar Network ; September 2015'
10+
const TESTNET_PASSPHRASE = 'Test SDF Network ; September 2015'
11+
const FUTURENET_PASSPHRASE = 'Test SDF Future Network ; October 2022'
12+
const SANDBOX_PASSPHRASE = 'Local Sandbox Stellar Network ; September 2022'
13+
const STANDALONE_PASSPHRASE = 'Standalone Network ; February 2017'
14+
15+
describe('Module exports', () => {
16+
test('should export public_chain', () => {
17+
expect(public_chain.id).toEqual('public')
18+
expect(public_chain.name).toEqual('Public')
19+
expect(public_chain.networkPassphrase).toEqual(PUBLIC_PASSPHRASE)
20+
})
21+
22+
test('should export futurenet', () => {
23+
expect(futurenet.id).toEqual('public')
24+
expect(futurenet.name).toEqual('Futurenet')
25+
expect(futurenet.networkPassphrase).toEqual(FUTURENET_PASSPHRASE)
26+
})
27+
28+
test('should export testnet', () => {
29+
expect(testnet.id).toEqual('public')
30+
expect(testnet.name).toEqual('Testnet')
31+
expect(testnet.networkPassphrase).toEqual(TESTNET_PASSPHRASE)
32+
})
33+
34+
test('should export sandbox', () => {
35+
expect(sandbox.id).toEqual('public')
36+
expect(sandbox.name).toEqual('Sandbox')
37+
expect(sandbox.networkPassphrase).toEqual(SANDBOX_PASSPHRASE)
38+
})
39+
40+
test('should export standalone', () => {
41+
expect(standalone.id).toEqual('public')
42+
expect(standalone.name).toEqual('Standalone')
43+
expect(standalone.networkPassphrase).toEqual(STANDALONE_PASSPHRASE)
44+
})
45+
})

packages/connect-button/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"repository": "github:esteblock/soroban-react",
99
"version": "5.0.3",
1010
"scripts": {
11-
"prebuild": "rm -rf dist",
11+
"prebuild": "del /s /q dist",
1212
"build": "tsc",
1313
"start": "tsc --watch"
1414
},

packages/contracts/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-react"]
3+
}

packages/contracts/jest.setup.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const { JSDOM } = require('jsdom')
2+
const React = require('react')
3+
const { useContext } = require('react')
4+
const { render } = require('react-dom')
5+
const { renderHook } = require('@testing-library/react-hooks')
6+
require('raf/polyfill')
7+
8+
const jsdom = new JSDOM('<!doctype html><html><body></body></html>')
9+
10+
global.window = jsdom.window
11+
global.document = jsdom.window.document
12+
global.navigator = {
13+
userAgent: 'node.js',
14+
}
15+
global.React = React
16+
global.useContext = useContext
17+
global.render = render
18+
global.renderHook = renderHook

packages/contracts/package.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,38 @@
88
"repository": "github:esteblock/soroban-react",
99
"version": "5.0.3",
1010
"scripts": {
11-
"prebuild": "rm -rf dist",
12-
"build": "tsc",
13-
"start": "tsc --watch"
11+
"prebuild": "del /s /q dist",
12+
"build": "yarn prebuild && tsc",
13+
"start": "tsc --watch",
14+
"prepare": "install-peers",
15+
"test-windows": "npm run prepare && npm run build && npm run jest",
16+
"test": "yarn prepare && yarn build && yarn jest"
1417
},
1518
"main": "dist/index.js",
1619
"exports": "./dist/index.js",
1720
"types": "dist/index.d.ts",
1821
"files": [
1922
"/dist"
2023
],
24+
"jest": {
25+
"setupFilesAfterEnv": [
26+
"./jest.setup.js"
27+
],
28+
"collectCoverage": true
29+
},
2130
"dependencies": {
2231
"@soroban-react/core": "^5.0.3",
2332
"soroban-client": "0.8.0"
2433
},
2534
"devDependencies": {
26-
"@types/react": "^18.0.25"
35+
"@babel/preset-react": "^7.22.5",
36+
"@testing-library/react-hooks": "^8.0.1",
37+
"@types/jest": "^29.5.2",
38+
"@types/react": "^18.0.25",
39+
"install-peers-cli": "^2.2.0",
40+
"jest": "^29.5.0",
41+
"jsdom": "^22.1.0",
42+
"ts-jest": "^29.1.0"
2743
},
2844
"peerDependencies": {
2945
"react": ">=16.8"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const yourFileExports = require('../dist/index.js')
2+
3+
describe('Module exports', () => {
4+
test('should export useContractValue', () => {
5+
expect(yourFileExports.useContractValue).toBeDefined()
6+
})
7+
8+
test('should export useSendTransaction', () => {
9+
expect(yourFileExports.useSendTransaction).toBeDefined()
10+
})
11+
12+
test('should export setTrustline', () => {
13+
expect(yourFileExports.setTrustline).toBeDefined()
14+
})
15+
})

0 commit comments

Comments
 (0)