Skip to content

Commit

Permalink
Merge branch 'develop' into build/fix-tests-replace-jest
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyg committed Mar 26, 2024
2 parents 9e3b943 + 8aa0d00 commit 685b643
Show file tree
Hide file tree
Showing 6 changed files with 448 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@
"webpack-cli": "^4.10.0"
},
"dependencies": {
"@holo-host/comb": "^0.3.2",
"@holo-host/web-sdk": "^0.6.18-prerelease",
"@holochain/client": "0.14.1",
"semver": "^7.5.1"
"@holo-host/comb": "0.3.2",
"@holochain/client": "0.16.10",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"semver": "^7.5.1",
"stream-browserify": "^3.0.0"
}
}
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Emittery from "emittery"
import semverSatisfies from 'semver/functions/satisfies'
import { AppInfoResponse, AppAgentClient, AppAgentCallZomeRequest, AppCreateCloneCellRequest, CreateCloneCellResponse, AgentPubKey, AppEnableCloneCellRequest, AppDisableCloneCellRequest, EnableCloneCellResponse, DisableCloneCellResponse, AppSignal, decodeHashFromBase64 } from '@holochain/client'
import { AppInfoResponse, AppAgentClient, AppAgentCallZomeRequest, AppCreateCloneCellRequest, CreateCloneCellResponse, AgentPubKey, AppEnableCloneCellRequest, AppDisableCloneCellRequest, EnableCloneCellResponse, DisableCloneCellResponse, AppSignal, decodeHashFromBase64, NetworkInfoResponse, AppAgentNetworkInfoRequest } from '@holochain/client'

const COMPATIBLE_CHAPERONE_VERSION = '>=0.1.1 <0.2.0'

Expand Down Expand Up @@ -192,6 +192,8 @@ class WebSdkApi implements AppAgentClient {

appInfo = (): Promise<AppInfoResponse> => this.#child.call('appInfo')

networkInfo = (args: AppAgentNetworkInfoRequest): Promise<NetworkInfoResponse> => this.#child.call('networkInfo', args)

callZome = async (args: AppAgentCallZomeRequest): Promise<any> => this.#child.call('callZome', args).then(unwrap)

createCloneCell = (args: AppCreateCloneCellRequest): Promise<CreateCloneCellResponse> => this.#child.call('createCloneCell', args).then(unwrap)
Expand Down
26 changes: 26 additions & 0 deletions tests/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,32 @@ describe('test API endpoints', () => {
expect(response).toMatchObject(expectedResponse)
})

it("should call network_info", async () => {
const expectedResponse = [
{
fetch_pool_info: {
op_bytes_to_fetch: 1,
num_ops_to_fetch: 1,
},
current_number_of_peers: 1,
arc_size: 1,
total_network_peers: 1,
bytes_since_last_time_queried: 1,
completed_rounds_since_last_time_queried: 1,
}
]

mock_comb.nextResponse(expectedResponse)

const response = await holo.networkInfo({
dnas: ['dna_hash'],
});

log.debug("Response: %s", response)

expect(response).toBeDefined()
})

it("should sign payloads", async () => {
const payload = { mockPayload: 'value' }
const expectedResponse = {
Expand Down
15 changes: 6 additions & 9 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ module.exports = {
},

resolve: {
extensions: [".ts", ".js"]
extensions: [".ts", ".js"],
fallback: {
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
buffer: require.resolve("buffer/"),
},
},

module: {
Expand All @@ -37,12 +42,4 @@ module.exports = {

plugins: [
],

externals: {
"node:crypto": {
commonjs: 'node:crypto',
commonjs2: 'node:crypto',
amd: 'node:crypto',
}
},
};
Loading

0 comments on commit 685b643

Please sign in to comment.