mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-03-15 21:51:04 +00:00
update aqua, object creation tests
This commit is contained in:
parent
e0fa922d55
commit
43163c15cb
@ -1,3 +1,9 @@
|
|||||||
|
aqua StructCreation declares getObj, getObjRelay, getObjAssign
|
||||||
|
|
||||||
|
export getObj, getObjRelay, getObjAssign
|
||||||
|
|
||||||
|
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||||
|
|
||||||
data InnerObj:
|
data InnerObj:
|
||||||
arr: []string
|
arr: []string
|
||||||
num: u32
|
num: u32
|
||||||
@ -7,9 +13,27 @@ data SomeObj:
|
|||||||
num: u64
|
num: u64
|
||||||
inner: InnerObj
|
inner: InnerObj
|
||||||
|
|
||||||
-- func getObj() -> SomeObj:
|
service OpNum("op"):
|
||||||
-- <- SomeObj("some str", 5, InnerObj(["a", "b", "c"], 6))
|
identity(n: u32) -> u32
|
||||||
--
|
|
||||||
-- func getObjAssign() -> SomeObj:
|
service OpStr("op"):
|
||||||
-- obj = SomeObj("some str", 5, InnerObj(["a", "b", "c"], 6))
|
identity(n: string) -> string
|
||||||
-- <- obj
|
|
||||||
|
service OpArr("op"):
|
||||||
|
identity(arr: []string) -> []string
|
||||||
|
|
||||||
|
func getObj() -> SomeObj:
|
||||||
|
<- SomeObj(str = OpStr.identity("some str"), num = 5, inner = InnerObj(arr = ["a", "b", "c"], num = 6))
|
||||||
|
|
||||||
|
func getObjRelay() -> SomeObj:
|
||||||
|
on HOST_PEER_ID:
|
||||||
|
obj = SomeObj(str = "some str", num = 5, inner = InnerObj(arr = OpArr.identity(["a", "b", "c"]), num = 6))
|
||||||
|
Op.noop()
|
||||||
|
<- obj
|
||||||
|
|
||||||
|
func getObjAssign() -> SomeObj:
|
||||||
|
obj = SomeObj(str = "some str",
|
||||||
|
num = OpNum.identity(5),
|
||||||
|
inner = InnerObj(arr = ["a", "b", "c"], num = 6)
|
||||||
|
)
|
||||||
|
<- obj
|
14
package-lock.json
generated
14
package-lock.json
generated
@ -18,7 +18,7 @@
|
|||||||
"fldist": "dist/index.js"
|
"fldist": "dist/index.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fluencelabs/aqua": "0.7.7-365",
|
"@fluencelabs/aqua": "0.8.0-366",
|
||||||
"@fluencelabs/aqua-dht": "0.2.5",
|
"@fluencelabs/aqua-dht": "0.2.5",
|
||||||
"@fluencelabs/aqua-lib": "0.6.0",
|
"@fluencelabs/aqua-lib": "0.6.0",
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
@ -618,9 +618,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@fluencelabs/aqua": {
|
"node_modules/@fluencelabs/aqua": {
|
||||||
"version": "0.7.7-365",
|
"version": "0.8.0-366",
|
||||||
"resolved": "https://npm.fluence.dev/@fluencelabs%2faqua/-/aqua-0.7.7-365.tgz",
|
"resolved": "https://npm.fluence.dev/@fluencelabs%2faqua/-/aqua-0.8.0-366.tgz",
|
||||||
"integrity": "sha512-pdHb8nkWQatXOifSiy0H4Ijwws0i/Incj5638YgIt5wmI9xTLCx/GyqurEUxpfcOQ6cYppXoLeFXkM+98b5gWw==",
|
"integrity": "sha512-FZlmnE7+UOXv9yrCqFyI8TMbRH72WCrY5k0E/XuX1Tpzy3TI+Nv1ciI1+AxCKhule1EtXcFhgALv81jvafsQkQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fluencelabs/aqua-ipfs": "0.5.5",
|
"@fluencelabs/aqua-ipfs": "0.5.5",
|
||||||
@ -8667,9 +8667,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@fluencelabs/aqua": {
|
"@fluencelabs/aqua": {
|
||||||
"version": "0.7.7-365",
|
"version": "0.8.0-366",
|
||||||
"resolved": "https://npm.fluence.dev/@fluencelabs%2faqua/-/aqua-0.7.7-365.tgz",
|
"resolved": "https://npm.fluence.dev/@fluencelabs%2faqua/-/aqua-0.8.0-366.tgz",
|
||||||
"integrity": "sha512-pdHb8nkWQatXOifSiy0H4Ijwws0i/Incj5638YgIt5wmI9xTLCx/GyqurEUxpfcOQ6cYppXoLeFXkM+98b5gWw==",
|
"integrity": "sha512-FZlmnE7+UOXv9yrCqFyI8TMbRH72WCrY5k0E/XuX1Tpzy3TI+Nv1ciI1+AxCKhule1EtXcFhgALv81jvafsQkQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@fluencelabs/aqua-ipfs": "0.5.5",
|
"@fluencelabs/aqua-ipfs": "0.5.5",
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
"do": "aqua dist deploy --addr /dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi --config-path deploy.json --service tsOracle"
|
"do": "aqua dist deploy --addr /dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi --config-path deploy.json --service tsOracle"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fluencelabs/aqua": "0.7.7-365",
|
"@fluencelabs/aqua": "0.8.0-366",
|
||||||
"@fluencelabs/aqua-dht": "0.2.5",
|
"@fluencelabs/aqua-dht": "0.2.5",
|
||||||
"@fluencelabs/aqua-lib": "0.6.0",
|
"@fluencelabs/aqua-lib": "0.6.0",
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {getObjCall} from "../examples/objectCall";
|
import {getObjAssignCall, getObjCall, getObjRelayCall} from "../examples/objectCall";
|
||||||
|
|
||||||
jest.retryTimes(1)
|
jest.retryTimes(1)
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ describe('Testing examples', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('object creation getObj', async () => {
|
it('object creation getObj', async () => {
|
||||||
let result = await getObjCall()
|
let result = await getObjCall()
|
||||||
expect(result).toEqual({
|
expect(result).toEqual({
|
||||||
str: "some str",
|
str: "some str",
|
||||||
@ -304,6 +304,30 @@ describe('Testing examples', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('object creation getObjRelay', async () => {
|
||||||
|
let result = await getObjRelayCall()
|
||||||
|
expect(result).toEqual({
|
||||||
|
str: "some str",
|
||||||
|
num: 5,
|
||||||
|
inner: {
|
||||||
|
arr: ["a", "b", "c"],
|
||||||
|
num: 6
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('object creation getObjAssign', async () => {
|
||||||
|
let result = await getObjAssignCall()
|
||||||
|
expect(result).toEqual({
|
||||||
|
str: "some str",
|
||||||
|
num: 5,
|
||||||
|
inner: {
|
||||||
|
arr: ["a", "b", "c"],
|
||||||
|
num: 6
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('collectionSugar stream', async () => {
|
it('collectionSugar stream', async () => {
|
||||||
let result = await streamSugarCall();
|
let result = await streamSugarCall();
|
||||||
expect(result).toEqual([
|
expect(result).toEqual([
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
// import {getObj, GetObjResult} from "../compiled/examples/object";
|
// import {getObj, GetObjResult} from "../compiled/examples/object";
|
||||||
|
|
||||||
|
import {getObj, getObjAssign, getObjRelay} from "../compiled/examples/object";
|
||||||
|
|
||||||
export async function getObjCall() {
|
export async function getObjCall() {
|
||||||
return await Promise.resolve();
|
return await getObj();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getObjRelayCall() {
|
||||||
|
return await getObjRelay();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getObjAssignCall() {
|
||||||
|
return await getObjAssign();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user