diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index acdc185b..5be01931 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install nix uses: cachix/install-nix-action@v22 diff --git a/flake.lock b/flake.lock index 85ae5f5c..cb107df3 100644 --- a/flake.lock +++ b/flake.lock @@ -189,23 +189,6 @@ "type": "github" } }, - "holochain_2": { - "flake": false, - "locked": { - "lastModified": 1694632043, - "narHash": "sha256-5QWUpWnwuzUi3hROrOZyQNla8iGdr+oGCH2nniRePBE=", - "owner": "holochain", - "repo": "holochain", - "rev": "1f59d33623031eefe76b5f3573970c9c33f21877", - "type": "github" - }, - "original": { - "owner": "holochain", - "ref": "holochain-0.2.2", - "repo": "holochain", - "type": "github" - } - }, "holonix": { "inputs": { "cargo-chef": "cargo-chef", @@ -215,7 +198,10 @@ "empty": "empty", "flake-compat": "flake-compat_2", "flake-parts": "flake-parts", - "holochain": "holochain", + "holochain": [ + "holonix", + "empty" + ], "lair": [ "holonix", "empty" @@ -238,11 +224,11 @@ ] }, "locked": { - "lastModified": 1696966770, - "narHash": "sha256-vs+gg7LLj8BZTsxfvzWl49lCGI4iST1Hc5+nAtKCSrY=", + "lastModified": 1698820331, + "narHash": "sha256-NTSZ1hdnrsDI7yBTK9COVXZf4lXfM6t2RXa0Q2bmtNg=", "owner": "holochain", "repo": "holochain", - "rev": "25aee0d63126db6abe9b039ddc2f54c53641beec", + "rev": "8521cee803aadb6e51fa967d57006eadf7861630", "type": "github" }, "original": { @@ -302,11 +288,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1696604326, - "narHash": "sha256-YXUNI0kLEcI5g8lqGMb0nh67fY9f2YoJsILafh6zlMo=", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "87828a0e03d1418e848d3dd3f3014a632e4a4f64", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", "type": "github" }, "original": { @@ -407,11 +393,11 @@ ] }, "locked": { - "lastModified": 1696817516, - "narHash": "sha256-Xt9OY4Wnk9/vuUfA0OHFtmSlaen5GyiS9msgwOz3okI=", + "lastModified": 1698804896, + "narHash": "sha256-vSms7A9bWHC00343qyXuNVm65LZDagDkukpkpwC2VxY=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c0df7f2a856b5ff27a3ce314f6d7aacf5fda546f", + "rev": "c5f8326c668b78275eccce90839861a3c8e1d3b2", "type": "github" }, "original": { @@ -454,18 +440,18 @@ }, "versions": { "inputs": { - "holochain": "holochain_2", + "holochain": "holochain", "lair": "lair", "launcher": "launcher", "scaffolding": "scaffolding" }, "locked": { "dir": "versions/0_2", - "lastModified": 1696966770, - "narHash": "sha256-vs+gg7LLj8BZTsxfvzWl49lCGI4iST1Hc5+nAtKCSrY=", + "lastModified": 1698820331, + "narHash": "sha256-NTSZ1hdnrsDI7yBTK9COVXZf4lXfM6t2RXa0Q2bmtNg=", "owner": "holochain", "repo": "holochain", - "rev": "25aee0d63126db6abe9b039ddc2f54c53641beec", + "rev": "8521cee803aadb6e51fa967d57006eadf7861630", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7234f13c..416cc192 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,6 @@ versions.url = "github:holochain/holochain?dir=versions/0_2"; holonix.url = "github:holochain/holochain"; holonix.inputs.versions.follows = "versions"; - holonix.inputs.holochain.url = "github:holochain/holochain/holochain-0.2.2"; }; outputs = inputs@{ holonix, ... }: @@ -16,7 +15,7 @@ perSystem = { config, system, pkgs, ... }: { devShells.default = pkgs.mkShell { - inputsFrom = [ holonix.devShells.${system}.holonix ]; + inputsFrom = [ holonix.devShells.${system}.holochainBinaries ]; packages = with pkgs; [ # add further packages from nixpkgs nodejs diff --git a/package-lock.json b/package-lock.json index 15fca372..e795c47b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -840,9 +840,9 @@ "integrity": "sha512-DJx4V2KXHVLciyOGjOYKTM/JLBpBEZ3RsPIRCgf7qmwhQdxXvhi2p+oFFRD51yUT5uC1/MzIVeJCl/R60PwFbw==" }, "node_modules/@holochain/tryorama": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/@holochain/tryorama/-/tryorama-0.15.0.tgz", - "integrity": "sha512-GWsiheb6AFkPkT1ho+dJeFRB2jVboIm/Gp+7v1LshKbDZrgY7oDEopyQPWmy4SkQQYItuscGaIdaOUJIQJuGKQ==", + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/@holochain/tryorama/-/tryorama-0.15.2.tgz", + "integrity": "sha512-Hgec9/KiQRxqZm/1LPN3EQ0GWOqusyhu+dC+XA5nJfARTDVM178mMmnQ08Uqk1s7FwA50Lq+/YAGpr4kIz7kBg==", "dependencies": { "@holochain/client": "^0.16.0", "get-port": "^6.1.2", @@ -7407,17 +7407,17 @@ }, "tests": { "dependencies": { - "@holochain/client": "^0.16.1", - "@holochain/tryorama": "0.15.0", + "@holochain/client": "^0.16.3", + "@holochain/tryorama": "0.15.2", "@msgpack/msgpack": "^2.8.0", "typescript": "^4.9.4", "vitest": "^0.28.5" } }, "tests/node_modules/@holochain/client": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.16.2.tgz", - "integrity": "sha512-1Msw6tSdCDI3f2UIdSAYtiAqxxdHt6ufmQSw+GEbvDaIjVXPQWi39IQe5Zzep4VPJoproyurrBRNG1l+/3YrjA==", + "version": "0.16.3", + "resolved": "https://registry.npmjs.org/@holochain/client/-/client-0.16.3.tgz", + "integrity": "sha512-bj/yWg3HJCQ1YcVX2yeZX5EiF2X8xv6jIC3q0g7GvdCAlwUqk4fieRQBf8ieYmd9WXmmfs55PVllYw2ofeR9ug==", "dependencies": { "@holochain/serialization": "^0.1.0-beta-rc.3", "@msgpack/msgpack": "^2.8.0", @@ -7430,7 +7430,7 @@ "ws": "^8.14.2" }, "engines": { - "node": ">=16.0.0 || >=18.0.0" + "node": ">=18.0.0 || >=20.0.0" } }, "tests/node_modules/typescript": { diff --git a/tests/package.json b/tests/package.json index 702503d4..cbc07860 100644 --- a/tests/package.json +++ b/tests/package.json @@ -5,8 +5,8 @@ "test": "vitest run" }, "dependencies": { - "@holochain/client": "^0.16.1", - "@holochain/tryorama": "0.15.0", + "@holochain/client": "^0.16.3", + "@holochain/tryorama": "0.15.2", "@msgpack/msgpack": "^2.8.0", "typescript": "^4.9.4", "vitest": "^0.28.5" diff --git a/tests/src/mewsfeed/agent_pins/pinner-to-hashes.test.ts b/tests/src/mewsfeed/agent_pins/pinner-to-hashes.test.ts index 843a4246..05e140dd 100644 --- a/tests/src/mewsfeed/agent_pins/pinner-to-hashes.test.ts +++ b/tests/src/mewsfeed/agent_pins/pinner-to-hashes.test.ts @@ -1,9 +1,9 @@ -import { assert, test } from "vitest"; +import { assert, it } from "vitest"; -import { runScenario, dhtSync } from "@holochain/tryorama"; import { AgentPubKey, HoloHash, fakeActionHash } from "@holochain/client"; +import { dhtSync, runScenario } from "@holochain/tryorama"; -test("link a Pinner to a Hash", async () => { +it("link a Pinner to a Hash", async () => { await runScenario( async (scenario) => { // Construct proper paths for your app. diff --git a/tests/src/mewsfeed/follows/follower-to-creators.test.ts b/tests/src/mewsfeed/follows/follower-to-creators.test.ts index b5326afb..67f5bde9 100644 --- a/tests/src/mewsfeed/follows/follower-to-creators.test.ts +++ b/tests/src/mewsfeed/follows/follower-to-creators.test.ts @@ -1,9 +1,9 @@ -import { assert, test, expect } from "vitest"; -import { runScenario, dhtSync } from "@holochain/tryorama"; import { AgentPubKey, Record } from "@holochain/client"; +import { dhtSync, runScenario } from "@holochain/tryorama"; +import { assert, expect, it } from "vitest"; import { mewsfeedAppBundleSource } from "../../common"; -test("link a Follower to a Creator", async () => { +it("link a Follower to a Creator", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -101,7 +101,7 @@ test("link a Follower to a Creator", async () => { ); }); -test("Agent cannot follow themselves", async () => { +it("Agent cannot follow themselves", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -121,17 +121,14 @@ test("Agent cannot follow themselves", async () => { fn_name: "follow", payload: alice.agentPubKey, }); - await expect(response).rejects.toHaveProperty( - "data.data", - expect.stringContaining("InvalidCommit") - ); + await expect(response).rejects.toThrowError(/InvalidCommit/); }, true, { timeout: 500000 } ); }); -test("Agent can only change their own follows", async () => { +it("Agent can only change their own follows", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -169,10 +166,7 @@ test("Agent can only change their own follows", async () => { target_creator: targetAddress, }, }); - await expect(response).rejects.toHaveProperty( - "data.data", - expect.stringContaining("InvalidCommit") - ); + await expect(response).rejects.toThrowError(/InvalidCommit/); // Alice removes her own follow await alice.cells[0].callZome({ @@ -192,275 +186,264 @@ test("Agent can only change their own follows", async () => { target_creator: targetAddress, }, }); - await expect(response2).rejects.toHaveProperty( - "data.data", - expect.stringContaining("InvalidCommit") - ); + await expect(response2).rejects.toThrowError(/InvalidCommit/); }, true, { timeout: 500000 } ); }); -test( - "Creators list are hash-paginated", - async () => { - await runScenario( - async (scenario) => { - // Set up the app to be installed - const appSource = { appBundleSource: mewsfeedAppBundleSource }; - - // Add 2 players with the test app to the Scenario. The returned players - // can be destructured. - const [alice, bob, carol, john, steve, mary] = - await scenario.addPlayersWithApps([ - appSource, - appSource, - appSource, - appSource, - appSource, - appSource, - ]); - - // Shortcut peer discovery through gossip and register all agents in every - // conductor of the scenario. - await scenario.shareAllAgents(); - - // Alice creates a link from Follower to Creator - await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "add_creator_for_follower", - payload: { - base_follower: alice.agentPubKey, - target_creator: bob.agentPubKey, - }, - }); - await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "add_creator_for_follower", - payload: { - base_follower: alice.agentPubKey, - target_creator: carol.agentPubKey, - }, - }); - await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "add_creator_for_follower", - payload: { - base_follower: alice.agentPubKey, - target_creator: john.agentPubKey, - }, - }); - await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "add_creator_for_follower", - payload: { - base_follower: alice.agentPubKey, - target_creator: steve.agentPubKey, - }, - }); - await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "add_creator_for_follower", - payload: { - base_follower: alice.agentPubKey, - target_creator: mary.agentPubKey, - }, - }); - - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - const page1: AgentPubKey[] = await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "get_creators_for_follower", - payload: { - follower: alice.agentPubKey, - page: { - limit: 2, - }, - }, - }); - - assert.deepEqual(page1[0], mary.agentPubKey); - assert.deepEqual(page1[1], steve.agentPubKey); - - const page2: AgentPubKey[] = await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "get_creators_for_follower", - payload: { - follower: alice.agentPubKey, - page: { - after_agentpubkey: page1[1], - limit: 2, - }, - }, - }); - assert.deepEqual(page2[0], john.agentPubKey); - assert.deepEqual(page2[1], carol.agentPubKey); - - const page3: AgentPubKey[] = await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "get_creators_for_follower", - payload: { - follower: alice.agentPubKey, - page: { - after_agentpubkey: page2[1], - limit: 2, - }, - }, - }); - assert.lengthOf(page3, 1); - assert.deepEqual(page3[0], bob.agentPubKey); - - const page5: AgentPubKey[] = await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "get_creators_for_follower", - payload: { - follower: alice.agentPubKey, - page: { - after_agentpubkey: page3[0], - limit: 2, - }, - }, - }); - assert.lengthOf(page5, 0); - }, - true, - { timeout: 500000 } - ); - }, - { timeout: 500000 } -); - -test( - "Followers list are hash-paginated", - async () => { - await runScenario( - async (scenario) => { - // Set up the app to be installed - const appSource = { appBundleSource: mewsfeedAppBundleSource }; - - // Add 2 players with the test app to the Scenario. The returned players - // can be destructured. - const [alice, bob, carol, john, steve, mary] = - await scenario.addPlayersWithApps([ - appSource, - appSource, - appSource, - appSource, - appSource, - appSource, - ]); - - // Shortcut peer discovery through gossip and register all agents in every - // conductor of the scenario. - await scenario.shareAllAgents(); - - // Alice creates a link from Follower to Creator - await bob.cells[0].callZome({ - zome_name: "follows", - fn_name: "add_creator_for_follower", - payload: { - base_follower: bob.agentPubKey, - target_creator: alice.agentPubKey, - }, - }); - await carol.cells[0].callZome({ - zome_name: "follows", - fn_name: "add_creator_for_follower", - payload: { - base_follower: carol.agentPubKey, - target_creator: alice.agentPubKey, +it("Creators list are hash-paginated", async () => { + await runScenario( + async (scenario) => { + // Set up the app to be installed + const appSource = { appBundleSource: mewsfeedAppBundleSource }; + + // Add 2 players with the test app to the Scenario. The returned players + // can be destructured. + const [alice, bob, carol, john, steve, mary] = + await scenario.addPlayersWithApps([ + appSource, + appSource, + appSource, + appSource, + appSource, + appSource, + ]); + + // Shortcut peer discovery through gossip and register all agents in every + // conductor of the scenario. + await scenario.shareAllAgents(); + + // Alice creates a link from Follower to Creator + await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "add_creator_for_follower", + payload: { + base_follower: alice.agentPubKey, + target_creator: bob.agentPubKey, + }, + }); + await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "add_creator_for_follower", + payload: { + base_follower: alice.agentPubKey, + target_creator: carol.agentPubKey, + }, + }); + await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "add_creator_for_follower", + payload: { + base_follower: alice.agentPubKey, + target_creator: john.agentPubKey, + }, + }); + await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "add_creator_for_follower", + payload: { + base_follower: alice.agentPubKey, + target_creator: steve.agentPubKey, + }, + }); + await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "add_creator_for_follower", + payload: { + base_follower: alice.agentPubKey, + target_creator: mary.agentPubKey, + }, + }); + + await dhtSync([alice, bob], alice.cells[0].cell_id[0]); + + const page1: AgentPubKey[] = await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "get_creators_for_follower", + payload: { + follower: alice.agentPubKey, + page: { + limit: 2, }, - }); - await john.cells[0].callZome({ - zome_name: "follows", - fn_name: "add_creator_for_follower", - payload: { - base_follower: john.agentPubKey, - target_creator: alice.agentPubKey, + }, + }); + + assert.deepEqual(page1[0], mary.agentPubKey); + assert.deepEqual(page1[1], steve.agentPubKey); + + const page2: AgentPubKey[] = await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "get_creators_for_follower", + payload: { + follower: alice.agentPubKey, + page: { + after_agentpubkey: page1[1], + limit: 2, }, - }); - await steve.cells[0].callZome({ - zome_name: "follows", - fn_name: "add_creator_for_follower", - payload: { - base_follower: steve.agentPubKey, - target_creator: alice.agentPubKey, + }, + }); + assert.deepEqual(page2[0], john.agentPubKey); + assert.deepEqual(page2[1], carol.agentPubKey); + + const page3: AgentPubKey[] = await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "get_creators_for_follower", + payload: { + follower: alice.agentPubKey, + page: { + after_agentpubkey: page2[1], + limit: 2, }, - }); - await mary.cells[0].callZome({ - zome_name: "follows", - fn_name: "add_creator_for_follower", - payload: { - base_follower: mary.agentPubKey, - target_creator: alice.agentPubKey, + }, + }); + assert.lengthOf(page3, 1); + assert.deepEqual(page3[0], bob.agentPubKey); + + const page5: AgentPubKey[] = await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "get_creators_for_follower", + payload: { + follower: alice.agentPubKey, + page: { + after_agentpubkey: page3[0], + limit: 2, }, - }); - - await dhtSync( - [alice, bob, carol, john, steve, mary], - alice.cells[0].cell_id[0] - ); - - const page1: AgentPubKey[] = await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "get_followers_for_creator", - payload: { - creator: alice.agentPubKey, - page: { - limit: 2, - }, + }, + }); + assert.lengthOf(page5, 0); + }, + true, + { timeout: 500000 } + ); +}); + +it("Followers list are hash-paginated", async () => { + await runScenario( + async (scenario) => { + // Set up the app to be installed + const appSource = { appBundleSource: mewsfeedAppBundleSource }; + + // Add 2 players with the test app to the Scenario. The returned players + // can be destructured. + const [alice, bob, carol, john, steve, mary] = + await scenario.addPlayersWithApps([ + appSource, + appSource, + appSource, + appSource, + appSource, + appSource, + ]); + + // Shortcut peer discovery through gossip and register all agents in every + // conductor of the scenario. + await scenario.shareAllAgents(); + + // Alice creates a link from Follower to Creator + await bob.cells[0].callZome({ + zome_name: "follows", + fn_name: "add_creator_for_follower", + payload: { + base_follower: bob.agentPubKey, + target_creator: alice.agentPubKey, + }, + }); + await carol.cells[0].callZome({ + zome_name: "follows", + fn_name: "add_creator_for_follower", + payload: { + base_follower: carol.agentPubKey, + target_creator: alice.agentPubKey, + }, + }); + await john.cells[0].callZome({ + zome_name: "follows", + fn_name: "add_creator_for_follower", + payload: { + base_follower: john.agentPubKey, + target_creator: alice.agentPubKey, + }, + }); + await steve.cells[0].callZome({ + zome_name: "follows", + fn_name: "add_creator_for_follower", + payload: { + base_follower: steve.agentPubKey, + target_creator: alice.agentPubKey, + }, + }); + await mary.cells[0].callZome({ + zome_name: "follows", + fn_name: "add_creator_for_follower", + payload: { + base_follower: mary.agentPubKey, + target_creator: alice.agentPubKey, + }, + }); + + await dhtSync( + [alice, bob, carol, john, steve, mary], + alice.cells[0].cell_id[0] + ); + + const page1: AgentPubKey[] = await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "get_followers_for_creator", + payload: { + creator: alice.agentPubKey, + page: { + limit: 2, }, - }); - - assert.deepEqual(page1[0], mary.agentPubKey); - assert.deepEqual(page1[1], steve.agentPubKey); - - const page2: AgentPubKey[] = await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "get_followers_for_creator", - payload: { - creator: alice.agentPubKey, - page: { - after_agentpubkey: page1[1], - limit: 2, - }, + }, + }); + + assert.deepEqual(page1[0], mary.agentPubKey); + assert.deepEqual(page1[1], steve.agentPubKey); + + const page2: AgentPubKey[] = await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "get_followers_for_creator", + payload: { + creator: alice.agentPubKey, + page: { + after_agentpubkey: page1[1], + limit: 2, }, - }); - assert.deepEqual(page2[0], john.agentPubKey); - assert.deepEqual(page2[1], carol.agentPubKey); - - const page3: AgentPubKey[] = await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "get_followers_for_creator", - payload: { - creator: alice.agentPubKey, - page: { - after_agentpubkey: page2[1], - limit: 2, - }, + }, + }); + assert.deepEqual(page2[0], john.agentPubKey); + assert.deepEqual(page2[1], carol.agentPubKey); + + const page3: AgentPubKey[] = await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "get_followers_for_creator", + payload: { + creator: alice.agentPubKey, + page: { + after_agentpubkey: page2[1], + limit: 2, }, - }); - assert.lengthOf(page3, 1); - assert.deepEqual(page3[0], bob.agentPubKey); - - const page5: AgentPubKey[] = await alice.cells[0].callZome({ - zome_name: "follows", - fn_name: "get_followers_for_creator", - payload: { - creator: alice.agentPubKey, - page: { - after_agentpubkey: page3[0], - limit: 2, - }, + }, + }); + assert.lengthOf(page3, 1); + assert.deepEqual(page3[0], bob.agentPubKey); + + const page5: AgentPubKey[] = await alice.cells[0].callZome({ + zome_name: "follows", + fn_name: "get_followers_for_creator", + payload: { + creator: alice.agentPubKey, + page: { + after_agentpubkey: page3[0], + limit: 2, }, - }); - assert.lengthOf(page5, 0); - }, - true, - { timeout: 500000 } - ); - }, - { timeout: 500000 } -); + }, + }); + assert.lengthOf(page5, 0); + }, + true, + { timeout: 500000 } + ); +}); diff --git a/tests/src/mewsfeed/likes/liker-to-hashes.test.ts b/tests/src/mewsfeed/likes/liker-to-hashes.test.ts index 6cea47fb..8e810092 100644 --- a/tests/src/mewsfeed/likes/liker-to-hashes.test.ts +++ b/tests/src/mewsfeed/likes/liker-to-hashes.test.ts @@ -1,9 +1,9 @@ -import { assert, expect, test } from "vitest"; -import { runScenario, dhtSync } from "@holochain/tryorama"; import { Record, fakeActionHash } from "@holochain/client"; +import { dhtSync, runScenario } from "@holochain/tryorama"; +import { assert, expect, it } from "vitest"; import { mewsfeedAppBundleSource } from "../../common"; -test("link a Liker to a Hash", async () => { +it("link a Liker to a Hash", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -91,7 +91,7 @@ test("link a Liker to a Hash", async () => { ); }); -test("Agent can only change their own likes", async () => { +it("Agent can only change their own likes", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -128,10 +128,7 @@ test("Agent can only change their own likes", async () => { target_hash: targetAddress, }, }); - await expect(response).rejects.toHaveProperty( - "data.data", - expect.stringContaining("InvalidCommit") - ); + await expect(response).rejects.toThrowError(/InvalidCommit/); // Alice removes her own like await alice.cells[0].callZome({ @@ -151,10 +148,7 @@ test("Agent can only change their own likes", async () => { target_hash: targetAddress, }, }); - await expect(response2).rejects.toHaveProperty( - "data.data", - expect.stringContaining("InvalidCommit") - ); + await expect(response2).rejects.toThrowError(/InvalidCommit/); }, true, { timeout: 500000 } diff --git a/tests/src/mewsfeed/mews/agent-mews.test.ts b/tests/src/mewsfeed/mews/agent-mews.test.ts index e09914cb..ddffd9ab 100644 --- a/tests/src/mewsfeed/mews/agent-mews.test.ts +++ b/tests/src/mewsfeed/mews/agent-mews.test.ts @@ -1,60 +1,56 @@ import { ActionHash } from "@holochain/client"; import { dhtSync, runScenario } from "@holochain/tryorama"; -import { assert, expect, test } from "vitest"; +import { assert, expect, it } from "vitest"; import { FeedMew, Mew, MewTypeName } from "../../../../ui/src/types/types"; import { mewsfeedAppBundleSource } from "../../common"; import { createMew } from "./common"; -test("create a Mew and get agent mews", async () => { - await runScenario( - async (scenario) => { - // Set up the app to be installed - const appSource = { appBundleSource: mewsfeedAppBundleSource }; - - // Add 2 players with the test app to the Scenario. The returned players - // can be destructured. - const [alice, bob] = await scenario.addPlayersWithApps([ - appSource, - appSource, - ]); - - // Shortcut peer discovery through gossip and register all agents in every - // conductor of the scenario. - await scenario.shareAllAgents(); - - // Bob gets agent mews - let collectionOutput: FeedMew[] = await bob.cells[0].callZome({ - zome_name: "mews", - fn_name: "get_agent_mews_with_context", - payload: { - agent: alice.agentPubKey, - }, - }); - assert.equal(collectionOutput.length, 0); - - // Alice creates a Mew - const actionHash: ActionHash = await createMew(alice.cells[0]); - assert.ok(actionHash); - - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - // Bob gets agent mews again - collectionOutput = await bob.cells[0].callZome({ - zome_name: "mews", - fn_name: "get_agent_mews_with_context", - payload: { - agent: alice.agentPubKey, - }, - }); - assert.equal(collectionOutput.length, 1); - assert.deepEqual(actionHash, collectionOutput[0].action_hash); - }, - true, - { timeout: 500000 } - ); +it("create a Mew and get agent mews", async () => { + await runScenario(async (scenario) => { + // Set up the app to be installed + const appSource = { appBundleSource: mewsfeedAppBundleSource }; + + // Add 2 players with the test app to the Scenario. The returned players + // can be destructured. + const [alice, bob] = await scenario.addPlayersWithApps([ + appSource, + appSource, + ]); + + // Shortcut peer discovery through gossip and register all agents in every + // conductor of the scenario. + await scenario.shareAllAgents(); + + // Bob gets agent mews + let collectionOutput: FeedMew[] = await bob.cells[0].callZome({ + zome_name: "mews", + fn_name: "get_agent_mews_with_context", + payload: { + agent: alice.agentPubKey, + }, + }); + assert.equal(collectionOutput.length, 0); + + // Alice creates a Mew + const actionHash: ActionHash = await createMew(alice.cells[0]); + assert.ok(actionHash); + + await dhtSync([alice, bob], alice.cells[0].cell_id[0]); + + // Bob gets agent mews again + collectionOutput = await bob.cells[0].callZome({ + zome_name: "mews", + fn_name: "get_agent_mews_with_context", + payload: { + agent: alice.agentPubKey, + }, + }); + assert.equal(collectionOutput.length, 1); + assert.deepEqual(actionHash, collectionOutput[0].action_hash); + }, true); }); -test("Agent mews list are time-paginated", async () => { +it("Agent mews lists are time-paginated", async () => { await runScenario( async (scenario) => { // Set up the app to be installed diff --git a/tests/src/mewsfeed/mews/agent-to-notifications.test.ts b/tests/src/mewsfeed/mews/agent-to-notifications.test.ts index 99104133..b8d28a43 100644 --- a/tests/src/mewsfeed/mews/agent-to-notifications.test.ts +++ b/tests/src/mewsfeed/mews/agent-to-notifications.test.ts @@ -1,6 +1,6 @@ import { ActionHash } from "@holochain/client"; import { dhtSync, runScenario } from "@holochain/tryorama"; -import { assert, expect, test } from "vitest"; +import { assert, expect, it } from "vitest"; import { FeedMew, Mew, @@ -11,7 +11,7 @@ import { import { mewsfeedAppBundleSource } from "../../common"; import { createMew } from "./common"; -test("notifications include my agent follows & unfollows", async () => { +it("notifications include my agent follows & unfollows", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -80,7 +80,7 @@ test("notifications include my agent follows & unfollows", async () => { ); }); -test("notifications include my mews' likes & unlikes", async () => { +it("notifications include my mews' likes & unlikes", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -161,7 +161,7 @@ test("notifications include my mews' likes & unlikes", async () => { ); }); -test("notifications include my mews' pins & unpins", async () => { +it("notifications include my mews' pins & unpins", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -242,7 +242,7 @@ test("notifications include my mews' pins & unpins", async () => { ); }); -test("notifications include my mews' replies, quotes, mewmews", async () => { +it("notifications include my mews' replies, quotes, mewmews", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -354,7 +354,7 @@ test("notifications include my mews' replies, quotes, mewmews", async () => { ); }); -test("notifications include replies, quotes, mewmews to mews that I also responded to", async () => { +it("notifications include replies, quotes, mewmews to mews that I also responded to", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -484,7 +484,7 @@ test("notifications include replies, quotes, mewmews to mews that I also respond ); }); -test("notifications list is time-paginated", async () => { +it("notifications list is time-paginated", async () => { await runScenario( async (scenario) => { // Set up the app to be installed diff --git a/tests/src/mewsfeed/mews/dna-properties.test.ts b/tests/src/mewsfeed/mews/dna-properties.test.ts index ffcc9369..b8f750a5 100644 --- a/tests/src/mewsfeed/mews/dna-properties.test.ts +++ b/tests/src/mewsfeed/mews/dna-properties.test.ts @@ -1,13 +1,13 @@ import { ActionHash } from "@holochain/client"; import { runScenario } from "@holochain/tryorama"; -import { assert, expect, test } from "vitest"; +import { assert, expect, it } from "vitest"; import { Mew, MewTypeName } from "../../../../ui/src/types/types.js"; import { mewsfeedAppBundleSource, mewsfeedAppBundleSourceNoLengthLimits, } from "../../common.js"; -test("Mew must not be longer than DNA property mew_characters_max chars", async () => { +it("Mew must not be longer than DNA property mew_characters_max chars", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -57,7 +57,7 @@ test("Mew must not be longer than DNA property mew_characters_max chars", async ); }); -test("Mew must not be shorter than DNA property mew_characters_min chars", async () => { +it("Mew must not be shorter than DNA property mew_characters_min chars", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -107,7 +107,7 @@ test("Mew must not be shorter than DNA property mew_characters_min chars", async ); }); -test("Mew can be any length if DNA property mew_characters_min and mew_characters_max not set", async () => { +it("Mew can be any length if DNA property mew_characters_min and mew_characters_max not set", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -162,7 +162,7 @@ test("Mew can be any length if DNA property mew_characters_min and mew_character ); }); -test("Can get deserialized DNA Properties", async () => { +it("Can get deserialized DNA Properties", async () => { await runScenario( async (scenario) => { // Set up the app to be installed diff --git a/tests/src/mewsfeed/mews/followed-creators-mews.test.ts b/tests/src/mewsfeed/mews/followed-creators-mews.test.ts index 073e25ad..b2ff09fd 100644 --- a/tests/src/mewsfeed/mews/followed-creators-mews.test.ts +++ b/tests/src/mewsfeed/mews/followed-creators-mews.test.ts @@ -1,11 +1,11 @@ -import { assert, expect, test } from "vitest"; -import { runScenario, dhtSync } from "@holochain/tryorama"; import { ActionHash } from "@holochain/client"; -import { createMew } from "./common"; +import { dhtSync, runScenario } from "@holochain/tryorama"; +import { assert, expect, it } from "vitest"; import { FeedMew, Mew, MewTypeName } from "../../../../ui/src/types/types"; import { mewsfeedAppBundleSource } from "../../common"; +import { createMew } from "./common"; -test("create a Mew and get followed creators mews", async () => { +it("create a Mew and get followed creators mews", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -58,7 +58,7 @@ test("create a Mew and get followed creators mews", async () => { ); }); -test("Followed creators mews should include mews of followed creator", async () => { +it("Followed creators mews should include mews of followed creator", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -92,8 +92,9 @@ test("Followed creators mews should include mews of followed creator", async () fn_name: "get_my_followed_creators_mews_with_context", payload: null, }); - assert.ok( - bobMewsFeedInitial.length === 0, + assert.equal( + bobMewsFeedInitial.length, + 0, "bob's mews feed is initially empty" ); @@ -108,7 +109,7 @@ test("Followed creators mews should include mews of followed creator", async () fn_name: "get_my_followed_creators_mews_with_context", payload: null, }); - assert.ok(bobMewsFeed.length === 1, "bob's mews feed includes 1 mew"); + assert.equal(bobMewsFeed.length, 1, "bob's mews feed includes 1 mew"); assert.equal( bobMewsFeed[0].mew.text, mewContent, @@ -120,7 +121,7 @@ test("Followed creators mews should include mews of followed creator", async () ); }); -test("Followed creators mews should include own mews", async () => { +it("Followed creators mews should include own mews", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -139,8 +140,9 @@ test("Followed creators mews should include own mews", async () => { fn_name: "get_my_followed_creators_mews_with_context", payload: null, }); - assert.ok( - aliceMewsFeedInitial.length === 0, + assert.equal( + aliceMewsFeedInitial.length, + 0, "alice's mews feed is initially empty" ); @@ -161,8 +163,9 @@ test("Followed creators mews should include own mews", async () => { fn_name: "get_my_followed_creators_mews_with_context", payload: null, }); - assert.ok( - aliceMewsFeed.length === 1, + assert.equal( + aliceMewsFeed.length, + 1, "alice's mews feed includes her mew" ); assert.equal( @@ -176,7 +179,7 @@ test("Followed creators mews should include own mews", async () => { ); }); -test("Followed creators mews should not include mews of non-followed creator", async () => { +it("Followed creators mews should not include mews of non-followed creator", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -230,7 +233,7 @@ test("Followed creators mews should not include mews of non-followed creator", a fn_name: "get_my_followed_creators_mews_with_context", payload: null, }); - assert.ok(bobMewsFeed.length === 1, "bob's mews feed includes 1 mew"); + assert.equal(bobMewsFeed.length, 1, "bob's mews feed includes 1 mew"); assert.equal( bobMewsFeed[0].mew.text, aliceMewContent, @@ -242,7 +245,7 @@ test("Followed creators mews should not include mews of non-followed creator", a ); }); -test("Unfollowing should exclude creators mews from feed", async () => { +it("Unfollowing should exclude creators mews from feed", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -283,8 +286,9 @@ test("Unfollowing should exclude creators mews from feed", async () => { fn_name: "get_my_followed_creators_mews_with_context", payload: null, }); - assert.ok( - bobMewsFeedWhenFollowing.length === 1, + assert.equal( + bobMewsFeedWhenFollowing.length, + 1, "bob's mews feed includes 1 mew" ); assert.equal( @@ -304,14 +308,14 @@ test("Unfollowing should exclude creators mews from feed", async () => { fn_name: "get_my_followed_creators_mews_with_context", payload: null, }); - assert.ok(bobMewsFeed.length === 0, "bob's mews feed is empty"); + assert.equal(bobMewsFeed.length, 0, "bob's mews feed is empty"); }, true, { timeout: 500000 } ); }); -test("Followed creators mews should be ordered by timestamp in descending order", async () => { +it("Followed creators mews should be ordered by timestamp in descending order", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -395,8 +399,9 @@ test("Followed creators mews should be ordered by timestamp in descending order" fn_name: "get_my_followed_creators_mews_with_context", payload: null, }); - assert.ok( - aliceMewsFeed.length === 4, + assert.equal( + aliceMewsFeed.length, + 4, "alice's mews feed includes all 4 mews" ); assert.equal( @@ -425,7 +430,7 @@ test("Followed creators mews should be ordered by timestamp in descending order" ); }); -test("Followed creators mews list are time-paginated", async () => { +it("Followed creators mews list are time-paginated", async () => { await runScenario( async (scenario) => { // Set up the app to be installed diff --git a/tests/src/mewsfeed/mews/mention-to-mews.test.ts b/tests/src/mewsfeed/mews/mention-to-mews.test.ts index 79eba740..a555db88 100644 --- a/tests/src/mewsfeed/mews/mention-to-mews.test.ts +++ b/tests/src/mewsfeed/mews/mention-to-mews.test.ts @@ -1,5 +1,6 @@ +import { ActionHash } from "@holochain/client"; import { dhtSync, runScenario } from "@holochain/tryorama"; -import { assert, expect, test } from "vitest"; +import { assert, expect, it } from "vitest"; import { FeedMew, LinkTargetName, @@ -8,9 +9,8 @@ import { } from "../../../../ui/src/types/types.js"; import { mewsfeedAppBundleSource } from "../../common.js"; import { createMew } from "./common.js"; -import { ActionHash } from "@holochain/client"; -test("mention in mews", async () => { +it("mention in mews", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -54,7 +54,7 @@ test("mention in mews", async () => { mention: bob.agentPubKey, }, }); - assert.ok(mentionedMewsBob.length === 2, "one mew with mention"); + assert.equal(mentionedMewsBob.length, 2, "one mew with mention"); assert.deepEqual(mentionedMewsBob[0].action_hash, actionHash2); const mentionedMewsAlice: FeedMew[] = await alice.cells[0].callZome({ @@ -64,7 +64,7 @@ test("mention in mews", async () => { mention: alice.agentPubKey, }, }); - assert.ok(mentionedMewsAlice.length === 1, "one mew with mention"); + assert.equal(mentionedMewsAlice.length, 1, "one mew with mention"); assert.deepEqual(mentionedMewsAlice[0].action_hash, actionHash3); }, true, @@ -72,7 +72,7 @@ test("mention in mews", async () => { ); }); -test("Mentions list are time-paginated", async () => { +it("Mentions list are time-paginated", async () => { await runScenario( async (scenario) => { // Set up the app to be installed diff --git a/tests/src/mewsfeed/mews/mew-to-responses.test.ts b/tests/src/mewsfeed/mews/mew-to-responses.test.ts index 219b7a03..61871fca 100644 --- a/tests/src/mewsfeed/mews/mew-to-responses.test.ts +++ b/tests/src/mewsfeed/mews/mew-to-responses.test.ts @@ -1,81 +1,77 @@ +import { ActionHash } from "@holochain/client"; import { runScenario } from "@holochain/tryorama"; -import { assert, expect, test } from "vitest"; +import { assert, expect, it } from "vitest"; import { FeedMew, Mew, MewTypeName } from "../../../../ui/src/types/types.js"; import { mewsfeedAppBundleSource } from "../../common.js"; -import { ActionHash } from "@holochain/client"; - -test("Agent can reply to a mew", async () => { - await runScenario( - async (scenario) => { - // Set up the app to be installed - const appSource = { appBundleSource: mewsfeedAppBundleSource }; - - // Add 2 players with the test app to the Scenario. The returned players - // can be destructured. - const [alice] = await scenario.addPlayersWithApps([appSource]); - - // Shortcut peer discovery through gossip and register all agents in every - // conductor of the scenario. - await scenario.shareAllAgents(); - - const aliceMewContent = "alice-test-mew"; - const aliceMewInput: Mew = { - text: aliceMewContent, - links: [], - mew_type: { [MewTypeName.Original]: null }, - }; - const action_hash: ActionHash = await alice.cells[0].callZome({ - zome_name: "mews", - fn_name: "create_mew", - payload: aliceMewInput, - }); - const aliceReplyContent = "alice-test-reply"; - const aliceReplyInput: Mew = { - text: aliceReplyContent, - links: [], - mew_type: { [MewTypeName.Reply]: action_hash }, - }; - const reply_action_hash: ActionHash = await alice.cells[0].callZome({ - zome_name: "mews", - fn_name: "create_mew", - payload: aliceReplyInput, - }); - - const replyMew: FeedMew = await alice.cells[0].callZome({ - zome_name: "mews", - fn_name: "get_mew_with_context", - payload: reply_action_hash, - }); - assert.ok(MewTypeName.Reply in replyMew.mew.mew_type, "mew is a reply"); - assert.equal( - replyMew.mew.text, - aliceReplyContent, - "reply is alice's reply" - ); - - const originalMew: FeedMew = await alice.cells[0].callZome({ - zome_name: "mews", - fn_name: "get_mew_with_context", - payload: action_hash, - }); - assert.ok( - MewTypeName.Original in originalMew.mew.mew_type, - "mew is an original mew" - ); - assert.equal(originalMew.mew.text, aliceMewContent, "mew is alice's mew"); - assert.ok(originalMew.replies_count === 1, "original mew has 1 reply"); - assert.isTrue( - originalMew.is_replied, - "original mew's reply is alice's reply" - ); - }, - true, - { timeout: 500000 } - ); +it("Agent can reply to a mew", async () => { + await runScenario(async (scenario) => { + // Set up the app to be installed + const appSource = { appBundleSource: mewsfeedAppBundleSource }; + + // Add 2 players with the test app to the Scenario. The returned players + // can be destructured. + const [alice] = await scenario.addPlayersWithApps([appSource]); + + // Shortcut peer discovery through gossip and register all agents in every + // conductor of the scenario. + await scenario.shareAllAgents(); + + const aliceMewContent = "alice-test-mew"; + const aliceMewInput: Mew = { + text: aliceMewContent, + links: [], + mew_type: { [MewTypeName.Original]: null }, + }; + const action_hash: ActionHash = await alice.cells[0].callZome({ + zome_name: "mews", + fn_name: "create_mew", + payload: aliceMewInput, + }); + + const aliceReplyContent = "alice-test-reply"; + const aliceReplyInput: Mew = { + text: aliceReplyContent, + links: [], + mew_type: { [MewTypeName.Reply]: action_hash }, + }; + const reply_action_hash: ActionHash = await alice.cells[0].callZome({ + zome_name: "mews", + fn_name: "create_mew", + payload: aliceReplyInput, + }); + + const replyMew: FeedMew = await alice.cells[0].callZome({ + zome_name: "mews", + fn_name: "get_mew_with_context", + payload: reply_action_hash, + }); + assert.ok(MewTypeName.Reply in replyMew.mew.mew_type, "mew is a reply"); + assert.equal( + replyMew.mew.text, + aliceReplyContent, + "reply is alice's reply" + ); + + const originalMew: FeedMew = await alice.cells[0].callZome({ + zome_name: "mews", + fn_name: "get_mew_with_context", + payload: action_hash, + }); + assert.ok( + MewTypeName.Original in originalMew.mew.mew_type, + "mew is an original mew" + ); + assert.equal(originalMew.mew.text, aliceMewContent, "mew is alice's mew"); + assert.equal(originalMew.replies_count, 1, "original mew has 1 reply"); + assert.isTrue( + originalMew.is_replied, + "original mew's reply is alice's reply" + ); + }, true); }); -test("Agent can mewmew a mew, only once", async () => { +it("Agent can mewmew a mew, only once", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -134,10 +130,10 @@ test("Agent can mewmew a mew, only once", async () => { "mew is an original mew" ); assert.equal(originalMew.mew.text, aliceMewContent, "mew is alice's mew"); - assert.ok(originalMew.mewmews_count === 1, "original mew has 1 mewmew"); + assert.equal(originalMew.mewmews_count, 1, "original mew has 1 mewmew"); assert.isTrue( originalMew.is_mewmewed, - "original mew's mewmew is alice's mewmew" + "original mew's mewmew is alice's mewmew" ); // Mewmew the same mew again @@ -146,17 +142,14 @@ test("Agent can mewmew a mew, only once", async () => { fn_name: "create_mew", payload: aliceMewmewInput, }); - await expect(response).rejects.toHaveProperty( - "data.data", - expect.stringContaining("InvalidCommit") - ); + await expect(response).rejects.toThrowError(/InvalidCommit/); }, true, { timeout: 500000 } ); }); -test("Agent can quote a mew", async () => { +it("Agent can quote a mew", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -214,7 +207,7 @@ test("Agent can quote a mew", async () => { "mew is an original mew" ); assert.equal(originalMew.mew.text, aliceMewContent, "mew is alice's mew"); - assert.ok(originalMew.quotes_count === 1, "original mew has 1 quote"); + assert.equal(originalMew.quotes_count, 1, "original mew has 1 quote"); assert.isTrue( originalMew.is_quoted, "original mew's quote is alice's quote" diff --git a/tests/src/mewsfeed/mews/mew-with-context.test.ts b/tests/src/mewsfeed/mews/mew-with-context.test.ts index b99e9b9b..c2be1113 100644 --- a/tests/src/mewsfeed/mews/mew-with-context.test.ts +++ b/tests/src/mewsfeed/mews/mew-with-context.test.ts @@ -1,12 +1,11 @@ import { ActionHash } from "@holochain/client"; -import { dhtSync, pause, runScenario } from "@holochain/tryorama"; -import { assert, expect, test } from "vitest"; -import { FeedMew, Mew, MewTypeName } from "../../../../ui/src/types/types"; +import { dhtSync, runScenario } from "@holochain/tryorama"; +import { assert, expect, it } from "vitest"; +import { FeedMew, MewTypeName } from "../../../../ui/src/types/types"; import { mewsfeedAppBundleSource } from "../../common"; import { createMew } from "./common"; - -test("Mew with context contains licks count and is_licked", async () => { +it("Mew with context contains licks count and is_licked", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -84,11 +83,11 @@ test("Mew with context contains licks count and is_licked", async () => { expect(aliceFeedMew.is_licked).false; }, true, - { timeout: 100000 } + { timeout: 500000 } ); }); -test("Mew with context contains replies count and is_replied", async () => { +it("Mew with context contains replies count and is_replied", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -143,11 +142,11 @@ test("Mew with context contains replies count and is_replied", async () => { expect(aliceFeedMew.is_replied).false; }, true, - { timeout: 100000 } + { timeout: 500000 } ); }); -test("Mew with context contains quotes count and is_quoted", async () => { +it("Mew with context contains quotes count and is_quoted", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -202,11 +201,11 @@ test("Mew with context contains quotes count and is_quoted", async () => { expect(aliceFeedMew.is_quoted).false; }, true, - { timeout: 100000 } + { timeout: 500000 } ); }); -test("Mew with context contains mewmews count and is_mewmewed", async () => { +it("Mew with context contains mewmews count and is_mewmewed", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -264,11 +263,11 @@ test("Mew with context contains mewmews count and is_mewmewed", async () => { expect(aliceFeedMew.is_mewmewed).false; }, true, - { timeout: 100000 } + { timeout: 500000 } ); }); -test("Mew with context contains is_pinned", async () => { +it("Mew with context contains is_pinned", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -342,6 +341,6 @@ test("Mew with context contains is_pinned", async () => { expect(aliceFeedMew.is_pinned).false; }, true, - { timeout: 100000 } + { timeout: 500000 } ); }); diff --git a/tests/src/mewsfeed/mews/pinner-to-mews.test.ts b/tests/src/mewsfeed/mews/pinner-to-mews.test.ts index c784031c..89f9a436 100644 --- a/tests/src/mewsfeed/mews/pinner-to-mews.test.ts +++ b/tests/src/mewsfeed/mews/pinner-to-mews.test.ts @@ -1,10 +1,10 @@ import { ActionHash } from "@holochain/client"; import { dhtSync, runScenario } from "@holochain/tryorama"; -import { assert, test } from "vitest"; +import { assert, it } from "vitest"; import { FeedMew } from "../../../../ui/src/types/types.js"; import { createMew } from "./common.js"; -test("link a Pinner to a Mew", async () => { +it("link a Pinner to a Mew", async () => { await runScenario( async (scenario) => { // Construct proper paths for your app. diff --git a/tests/src/mewsfeed/mews/tags-to-mews.test.ts b/tests/src/mewsfeed/mews/tags-to-mews.test.ts index 7d4e2133..fb9367a7 100644 --- a/tests/src/mewsfeed/mews/tags-to-mews.test.ts +++ b/tests/src/mewsfeed/mews/tags-to-mews.test.ts @@ -1,6 +1,6 @@ import { ActionHash } from "@holochain/client"; -import { pause, runScenario } from "@holochain/tryorama"; -import { assert, expect, test } from "vitest"; +import { runScenario } from "@holochain/tryorama"; +import { assert, expect, it } from "vitest"; import { FeedMew, LinkTargetName, @@ -10,7 +10,7 @@ import { } from "../../../../ui/src/types/types.js"; import { mewsfeedAppBundleSource } from "../../common.js"; -test("Hashtag, cashtag and mention", async () => { +it("Hashtag, cashtag and mention", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -50,7 +50,7 @@ test("Hashtag, cashtag and mention", async () => { hashtag: "#hashtag", }, }); - assert.ok(hashtaggedMews.length === 1, "one mew with hashtag"); + assert.equal(hashtaggedMews.length, 1, "one mew with hashtag"); assert.equal( hashtaggedMews[0].mew.text, mewContent, @@ -82,7 +82,7 @@ test("Hashtag, cashtag and mention", async () => { hashtag: "#😃😃😃", }, }); - assert.ok(emojiHashtaggedMews.length === 0, "no mew with emoji hashtag"); + assert.equal(emojiHashtaggedMews.length, 0, "no mew with emoji hashtag"); const cashtaggedMews: FeedMew[] = await alice.cells[0].callZome({ zome_name: "mews", @@ -91,7 +91,7 @@ test("Hashtag, cashtag and mention", async () => { cashtag: "$cashtag", }, }); - assert.ok(cashtaggedMews.length === 1, "one mew with cashtag"); + assert.equal(cashtaggedMews.length, 1, "one mew with cashtag"); const mentionedMews: FeedMew[] = await alice.cells[0].callZome({ zome_name: "mews", @@ -100,14 +100,14 @@ test("Hashtag, cashtag and mention", async () => { mention: alice.agentPubKey, }, }); - assert.ok(mentionedMews.length === 1, "one mew with mention"); + assert.equal(mentionedMews.length, 1, "one mew with mention"); }, true, { timeout: 500000 } ); }); -test("Prefix index should return hashtags and cashtags", async () => { +it("Prefix index should return hashtags and cashtags", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -148,7 +148,7 @@ test("Prefix index should return hashtags and cashtags", async () => { limit: 10, }, }); - assert.ok(hashtags.length === 1, "one hashtag"); + assert.equal(hashtags.length, 1, "one hashtag"); assert.equal(hashtags[0], "#hashtag", "hashtag search result matches"); const arabicHashtags: string[] = await alice.cells[0].callZome({ @@ -159,7 +159,7 @@ test("Prefix index should return hashtags and cashtags", async () => { limit: 10, }, }); - assert.ok(arabicHashtags.length === 1, "one arabic hashtag"); + assert.equal(arabicHashtags.length, 1, "one arabic hashtag"); assert.equal( arabicHashtags[0], "#سعيدة", @@ -175,7 +175,7 @@ test("Prefix index should return hashtags and cashtags", async () => { limit: 10, }, }); - assert.ok(emojiHashtags.length === 0, "no emoji hashtags"); + assert.equal(emojiHashtags.length, 0, "no emoji hashtags"); const cashtags: string[] = await alice.cells[0].callZome({ zome_name: "mews", @@ -185,7 +185,7 @@ test("Prefix index should return hashtags and cashtags", async () => { limit: 10, }, }); - assert.ok(cashtags.length === 1, "one cashtag"); + assert.equal(cashtags.length, 1, "one cashtag"); assert.equal(cashtags[0], "$cashtag", "hashtag search result matches"); }, true, @@ -193,7 +193,7 @@ test("Prefix index should return hashtags and cashtags", async () => { ); }); -test("Hashtags list are time-paginated", async () => { +it("Hashtags list are time-paginated", async () => { await runScenario( async (scenario) => { // Set up the app to be installed @@ -392,7 +392,7 @@ test("Hashtags list are time-paginated", async () => { ); }); -test("Cashtags list are time-paginated", async () => { +it("Cashtags list are time-paginated", async () => { await runScenario( async (scenario) => { // Set up the app to be installed diff --git a/tests/vitest.config.ts b/tests/vitest.config.ts index e81c748a..48b357b5 100644 --- a/tests/vitest.config.ts +++ b/tests/vitest.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ test: { threads: false, - testTimeout: 60 * 1000 * 10, // 10 mins + testTimeout: 600 * 1000 * 10, // 10 mins outputDiffLines: 100, outputDiffMaxSize: 100000, }, diff --git a/ui/src/stores/toasts.ts b/ui/src/stores/toasts.ts index e398c3a2..d1456def 100644 --- a/ui/src/stores/toasts.ts +++ b/ui/src/stores/toasts.ts @@ -14,8 +14,6 @@ export const useToasts = defineStore("toasts", () => { let text; if (error instanceof Error) { text = error.message; - } else if (error.type === "error" && "data" in error) { - text = error.data.data; } else { text = JSON.stringify(error, null, 4); }