Skip to content

Instantly share code, notes, and snippets.

@JhonatanHern
Created August 21, 2019 16:03
Show Gist options
  • Save JhonatanHern/515de72ea103bf87e097ab5b12cbffef to your computer and use it in GitHub Desktop.
Save JhonatanHern/515de72ea103bf87e097ab5b12cbffef to your computer and use it in GitHub Desktop.
const path = require('path')
const tape = require('tape')
const { Diorama, tapeExecutor, backwardCompatibilityMiddleware } = require('@holochain/diorama')
process.on('unhandledRejection', error => {
// Will print "unhandledRejection err is not defined"
console.error('got unhandledRejection:', error);
})
const dnaPath = path.join(__dirname, "../dist/backend.dna.json")
const dna = Diorama.dna(dnaPath, 'backend')
const diorama = new Diorama({
instances: {
alice: dna,
bob: dna,
},
bridges: [],
debugLog: false,
executor: tapeExecutor(tape),
middleware: backwardCompatibilityMiddleware,
})
diorama.registerScenario("description of example test", async (s, /*t,*/ { alice }) => {
const res = alice.call("messaging", "reee", {s:'Example String'})
// t.deepEqual(res, {Ok:'Example String'})
})
diorama.registerScenario("Can create an user", async (s, /*t,*/ { alice }) => {
const addr = alice.call("messaging", "create_user", {
"username":"JhonatanHern"
})
// t.deepEqual({ Ok: 'QmVVDRffrS8gZXyCDmfB5X6MtcTWhsbeohWyTWrxEQoFZK' },addr)
})
diorama.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment