-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add initial headless template * include headless template in ui framework choices * add web-app instructions and prefer explicit hc commands in all package.json templates * rename instructions template * fix indentation in instructions * update instructions * remove gitkeep * refactor UiFramework struct * refactor tempalte config access * remove assertion * revert renaming * revert integrity zome name * choose non vanilla framework for non hello world examples * simplify ui framework prompts; update instructions * update instructions * Update scripts and instructions * color code ui frameworks * templatify web-happ manifest * fix bug writing invalid template config * remove unnecessary print statement * remove unnecessary return statement * update ui framework try from filetree implementation * refactor: refactor reserved words check * update ansi colors for lit and svelte * Add build happ instruction
- Loading branch information
Showing
23 changed files
with
837 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case collection_name}}.test.ts.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { assert, test } from "vitest"; | ||
|
||
import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama'; | ||
import { | ||
NewEntryAction, | ||
ActionHash, | ||
Record, | ||
Link, | ||
AppBundleSource, | ||
fakeActionHash, | ||
fakeAgentPubKey, | ||
fakeEntryHash | ||
} from '@holochain/client'; | ||
import { decode } from '@msgpack/msgpack'; | ||
|
||
import { create{{pascal_case referenceable.name}} } from './common.js'; | ||
|
||
test('create a {{pascal_case referenceable.name}} and get {{lower_case collection_name}}', async () => { | ||
await runScenario(async scenario => { | ||
// Construct proper paths for your app. | ||
// This assumes app bundle created by the `hc app pack` command. | ||
const testAppPath = process.cwd() + '/../workdir/{{app_name}}.happ'; | ||
|
||
// Set up the app to be installed | ||
const appSource = { appBundleSource: { path: testAppPath } }; | ||
|
||
// 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 {{lower_case collection_name}} | ||
let collectionOutput: Link[] = await bob.cells[0].callZome({ | ||
zome_name: "{{coordinator_zome_manifest.name}}", | ||
fn_name: "get_{{snake_case collection_name}}", | ||
payload: {{#if (eq collection_type.type "Global")}}null{{else}}alice.agentPubKey{{/if}} | ||
}); | ||
assert.equal(collectionOutput.length, 0); | ||
|
||
// Alice creates a {{pascal_case referenceable.name}} | ||
const createRecord: Record = await create{{pascal_case referenceable.name}}(alice.cells[0]); | ||
assert.ok(createRecord); | ||
|
||
await dhtSync([alice, bob], alice.cells[0].cell_id[0]); | ||
|
||
// Bob gets {{lower_case collection_name}} again | ||
collectionOutput = await bob.cells[0].callZome({ | ||
zome_name: "{{coordinator_zome_manifest.name}}", | ||
fn_name: "get_{{snake_case collection_name}}", | ||
payload: {{#if (eq collection_type.type "Global")}}null{{else}}alice.agentPubKey{{/if}} | ||
}); | ||
assert.equal(collectionOutput.length, 1); | ||
assert.deepEqual({{#if (eq referenceable.hash_type "EntryHash")}}(createRecord.signed_action.hashed.content as NewEntryAction).entry_hash{{else}}createRecord.signed_action.hashed.hash{{/if}}, collectionOutput[0].target); | ||
{{#if (and deletable (eq referenceable.hash_type "ActionHash"))}} | ||
|
||
// Alice deletes the {{pascal_case referenceable.name}} | ||
await alice.cells[0].callZome({ | ||
zome_name: "{{coordinator_zome_manifest.name}}", | ||
fn_name: "delete_{{snake_case referenceable.name}}", | ||
payload: createRecord.signed_action.hashed.hash | ||
}); | ||
|
||
await dhtSync([alice, bob], alice.cells[0].cell_id[0]); | ||
|
||
// Bob gets {{lower_case collection_name}} again | ||
collectionOutput = await bob.cells[0].callZome({ | ||
zome_name: "{{coordinator_zome_manifest.name}}", | ||
fn_name: "get_{{snake_case collection_name}}", | ||
payload: {{#if (eq collection_type.type "Global")}}null{{else}}alice.agentPubKey{{/if}} | ||
}); | ||
assert.equal(collectionOutput.length, 0); | ||
{{/if}} | ||
}); | ||
}); | ||
|
3 changes: 3 additions & 0 deletions
3
...eadless/coordinator-zome/tests/src/{{dna_role_name}}/{{zome_manifest.name}}/common.ts.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { CallableCell } from '@holochain/tryorama'; | ||
import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeActionHash, fakeAgentPubKey, fakeEntryHash, fakeDnaHash } from '@holochain/client'; | ||
|
Oops, something went wrong.