Skip to content

Commit

Permalink
Merge pull request #141 from holochain/feat/replace-test-pause-with-d…
Browse files Browse the repository at this point in the history
…htsync2

feat/replace test pause with dhtsync2
  • Loading branch information
ThetaSinner authored Nov 3, 2023
2 parents 20745e8 + 0b53054 commit 8f62be1
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -35,7 +35,7 @@ test('create a {{pascal_case referenceable.name}} and get {{lower_case collectio
const createdRecord: Record = await create{{pascal_case referenceable.name}}(alice.cells[0]);
assert.ok(createdRecord);

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets {{lower_case collection_name}} again
collectionOutput = await bob.cells[0].callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeDnaHash, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -53,7 +53,7 @@ test('create and read {{pascal_case entry_type.name}}', async () => {
assert.ok(record);

// Wait for the created entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the created {{pascal_case entry_type.name}}
const createReadOutput: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -107,7 +107,7 @@ test('create and update {{pascal_case entry_type.name}}', async () => {
assert.ok(updatedRecord);

// Wait for the updated entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the updated {{pascal_case entry_type.name}}
const readUpdatedOutput0: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -135,7 +135,7 @@ test('create and update {{pascal_case entry_type.name}}', async () => {
assert.ok(updatedRecord);

// Wait for the updated entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the updated {{pascal_case entry_type.name}}
const readUpdatedOutput1: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -179,7 +179,7 @@ test('create and delete {{pascal_case entry_type.name}}', async () => {
assert.ok(deleteActionHash);

// Wait for the entry deletion to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob tries to get the deleted {{pascal_case entry_type.name}}
const readDeletedOutput = await bob.cells[0].callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -67,7 +67,7 @@ test('link a {{pascal_case from_referenceable.name}} to a {{pascal_case to_refer
}
});

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
Expand Down Expand Up @@ -104,7 +104,7 @@ test('link a {{pascal_case from_referenceable.name}} to a {{pascal_case to_refer
}
});

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -35,7 +35,7 @@ test('create a {{pascal_case referenceable.name}} and get {{lower_case collectio
const createdRecord: Record = await create{{pascal_case referenceable.name}}(alice.cells[0]);
assert.ok(createdRecord);

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets {{lower_case collection_name}} again
collectionOutput = await bob.cells[0].callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeDnaHash, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -53,7 +53,7 @@ test('create and read {{pascal_case entry_type.name}}', async () => {
assert.ok(record);

// Wait for the created entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the created {{pascal_case entry_type.name}}
const createReadOutput: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -107,7 +107,7 @@ test('create and update {{pascal_case entry_type.name}}', async () => {
assert.ok(updatedRecord);

// Wait for the updated entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the updated {{pascal_case entry_type.name}}
const readUpdatedOutput0: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -135,7 +135,7 @@ test('create and update {{pascal_case entry_type.name}}', async () => {
assert.ok(updatedRecord);

// Wait for the updated entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the updated {{pascal_case entry_type.name}}
const readUpdatedOutput1: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -179,7 +179,7 @@ test('create and delete {{pascal_case entry_type.name}}', async () => {
assert.ok(deleteActionHash);

// Wait for the entry deletion to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob tries to get the deleted {{pascal_case entry_type.name}}
const readDeletedOutput = await bob.cells[0].callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -67,7 +67,7 @@ test('link a {{pascal_case from_referenceable.name}} to a {{pascal_case to_refer
}
});

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
Expand Down Expand Up @@ -104,7 +104,7 @@ test('link a {{pascal_case from_referenceable.name}} to a {{pascal_case to_refer
}
});

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -35,7 +35,7 @@ test('create a {{pascal_case referenceable.name}} and get {{lower_case collectio
const createdRecord: Record = await create{{pascal_case referenceable.name}}(alice.cells[0]);
assert.ok(createdRecord);

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets {{lower_case collection_name}} again
collectionOutput = await bob.cells[0].callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeDnaHash, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -53,7 +53,7 @@ test('create and read {{pascal_case entry_type.name}}', async () => {
assert.ok(record);

// Wait for the created entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the created {{pascal_case entry_type.name}}
const createReadOutput: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -107,7 +107,7 @@ test('create and update {{pascal_case entry_type.name}}', async () => {
assert.ok(updatedRecord);

// Wait for the updated entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the updated {{pascal_case entry_type.name}}
const readUpdatedOutput0: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -135,7 +135,7 @@ test('create and update {{pascal_case entry_type.name}}', async () => {
assert.ok(updatedRecord);

// Wait for the updated entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the updated {{pascal_case entry_type.name}}
const readUpdatedOutput1: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -179,7 +179,7 @@ test('create and delete {{pascal_case entry_type.name}}', async () => {
assert.ok(deleteActionHash);

// Wait for the entry deletion to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob tries to get the deleted {{pascal_case entry_type.name}}
const readDeletedOutput = await bob.cells[0].callZome({
Expand Down
4 changes: 2 additions & 2 deletions templates/vanilla/example/tests/hello-world.test.ts.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause } from '@holochain/tryorama';
import { runScenario, dhtSync } from '@holochain/tryorama';


test('send hello and retrieve hellos', async () => {
Expand Down Expand Up @@ -38,7 +38,7 @@ test('send hello and retrieve hellos', async () => {
});
assert.ok(resultBeto);

await pause(1000) // wait for DHT to settle
await dhtSync([alice, beto], alice.cells[0].cell_id[0]);

// Alice gets all hellos
const hellosAlice: Array<any> = await aliceCell.callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -67,7 +67,7 @@ test('link a {{pascal_case from_referenceable.name}} to a {{pascal_case to_refer
}
});

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
Expand Down Expand Up @@ -104,7 +104,7 @@ test('link a {{pascal_case from_referenceable.name}} to a {{pascal_case to_refer
}
});

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -35,7 +35,7 @@ test('create a {{pascal_case referenceable.name}} and get {{lower_case collectio
const createdRecord: Record = await create{{pascal_case referenceable.name}}(alice.cells[0]);
assert.ok(createdRecord);

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets {{lower_case collection_name}} again
collectionOutput = await bob.cells[0].callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeDnaHash, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -53,7 +53,7 @@ test('create and read {{pascal_case entry_type.name}}', async () => {
assert.ok(record);

// Wait for the created entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the created {{pascal_case entry_type.name}}
const createReadOutput: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -107,7 +107,7 @@ test('create and update {{pascal_case entry_type.name}}', async () => {
assert.ok(updatedRecord);

// Wait for the updated entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the updated {{pascal_case entry_type.name}}
const readUpdatedOutput0: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -135,7 +135,7 @@ test('create and update {{pascal_case entry_type.name}}', async () => {
assert.ok(updatedRecord);

// Wait for the updated entry to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the updated {{pascal_case entry_type.name}}
const readUpdatedOutput1: Record = await bob.cells[0].callZome({
Expand Down Expand Up @@ -179,7 +179,7 @@ test('create and delete {{pascal_case entry_type.name}}', async () => {
assert.ok(deleteActionHash);

// Wait for the entry deletion to be propagated to the other node.
await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob tries to get the deleted {{pascal_case entry_type.name}}
const readDeletedOutput = await bob.cells[0].callZome({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, test } from "vitest";

import { runScenario, pause, CallableCell } from '@holochain/tryorama';
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama';
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeActionHash, fakeAgentPubKey, fakeEntryHash } from '@holochain/client';
import { decode } from '@msgpack/msgpack';

Expand Down Expand Up @@ -67,7 +67,7 @@ test('link a {{pascal_case from_referenceable.name}} to a {{pascal_case to_refer
}
});

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
Expand Down Expand Up @@ -104,7 +104,7 @@ test('link a {{pascal_case from_referenceable.name}} to a {{pascal_case to_refer
}
});

await pause(1200);
await dhtSync([alice, bob], alice.cells[0].cell_id[0]);

// Bob gets the links again
linksOutput = await bob.cells[0].callZome({
Expand Down

0 comments on commit 8f62be1

Please sign in to comment.