From a36a22d40b3519ad8fb5009f5a07a308bc4079f8 Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Fri, 22 Sep 2023 12:07:46 -0700 Subject: [PATCH] Still trying to minimize the diffs --- package.json | 2 +- test/unit/contract_spec.js | 458 +++++++++--------- .../unit/server/horizon/claimable_balances.js | 112 ++--- test/unit/server/horizon/join_test.js | 140 +++--- 4 files changed, 362 insertions(+), 350 deletions(-) diff --git a/package.json b/package.json index b66c67020..1a36d3c57 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "_build": "yarn build:node && yarn build:test && yarn build:browser", "_babel": "babel --extensions '.ts' --out-dir lib/ src/", "_nyc": "nyc --nycrc-path config/.nycrc", - "_prettier": "prettier --config config/prettier.config.js --ignore-path config/.prettierignore --write './**/*.js'" + "_prettier": "prettier --ignore-path config/.prettierignore --write './test/unit/server/horizon/**/*.js'" }, "husky": { "hooks": { diff --git a/test/unit/contract_spec.js b/test/unit/contract_spec.js index cf0d5f453..ae3010cb9 100644 --- a/test/unit/contract_spec.js +++ b/test/unit/contract_spec.js @@ -1,244 +1,256 @@ -import { xdr, ContractSpec, Address } from "../../lib"; +import { xdr, ContractSpec, Address } from '../../lib'; //@ts-ignore -import spec from "../spec.json"; -import { expect } from "chai"; -const publicKey = "GCBVOLOM32I7OD5TWZQCIXCXML3TK56MDY7ZMTAILIBQHHKPCVU42XYW"; +import spec from '../spec.json'; +import { expect } from 'chai'; +const publicKey = 'GCBVOLOM32I7OD5TWZQCIXCXML3TK56MDY7ZMTAILIBQHHKPCVU42XYW'; const addr = Address.fromString(publicKey); let SPEC; before(() => { - SPEC = new ContractSpec(spec); + SPEC = new ContractSpec(spec); }); -it("throws if no entries", () => { - expect(() => new ContractSpec([])).to.throw(/Contract spec must have at least one entry/i); +it('throws if no entries', () => { + expect(() => new ContractSpec([])).to.throw( + /Contract spec must have at least one entry/i + ); }); -describe("Can round trip custom types", function () { - function getResultType(funcName) { - let fn = SPEC.findEntry(funcName).value(); - if (!(fn instanceof xdr.ScSpecFunctionV0)) { - throw new Error("Not a function"); - } - if (fn.outputs().length === 0) { - return xdr.ScSpecTypeDef.scSpecTypeVoid(); - } - return fn.outputs()[0]; +describe('Can round trip custom types', function () { + function getResultType(funcName) { + let fn = SPEC.findEntry(funcName).value(); + if (!(fn instanceof xdr.ScSpecFunctionV0)) { + throw new Error('Not a function'); } - function roundtrip(funcName, input, typeName) { - let type = getResultType(funcName); - let ty = typeName ?? funcName; - let obj = {}; - obj[ty] = input; - let scVal = SPEC.funcArgsToScVals(funcName, obj)[0]; - let result = SPEC.scValToNative(scVal, type); - expect(result).deep.equal(input); + if (fn.outputs().length === 0) { + return xdr.ScSpecTypeDef.scSpecTypeVoid(); } - it("u32", () => { - roundtrip("u32_", 1); + return fn.outputs()[0]; + } + function roundtrip(funcName, input, typeName) { + let type = getResultType(funcName); + let ty = typeName ?? funcName; + let obj = {}; + obj[ty] = input; + let scVal = SPEC.funcArgsToScVals(funcName, obj)[0]; + let result = SPEC.scValToNative(scVal, type); + expect(result).deep.equal(input); + } + it('u32', () => { + roundtrip('u32_', 1); + }); + it('i32', () => { + roundtrip('i32_', -1); + }); + it('i64', () => { + roundtrip('i64_', 1n); + }); + it('strukt', () => { + roundtrip('strukt', { a: 0, b: true, c: 'hello' }); + }); + describe('simple', () => { + it('first', () => { + const simple = { tag: 'First', values: undefined }; + roundtrip('simple', simple); }); - it("i32", () => { - roundtrip("i32_", -1); + it('simple second', () => { + const simple = { tag: 'Second', values: undefined }; + roundtrip('simple', simple); }); - it("i64", () => { - roundtrip("i64_", 1n); + it('simple third', () => { + const simple = { tag: 'Third', values: undefined }; + roundtrip('simple', simple); }); - it("strukt", () => { - roundtrip("strukt", { a: 0, b: true, c: "hello" }); + }); + describe('complex', () => { + it('struct', () => { + const complex = { + tag: 'Struct', + values: [{ a: 0, b: true, c: 'hello' }] + }; + roundtrip('complex', complex); }); - describe("simple", () => { - it("first", () => { - const simple = { tag: "First", values: undefined }; - roundtrip("simple", simple); - }); - it("simple second", () => { - const simple = { tag: "Second", values: undefined }; - roundtrip("simple", simple); - }); - it("simple third", () => { - const simple = { tag: "Third", values: undefined }; - roundtrip("simple", simple); - }); + it('tuple', () => { + const complex = { + tag: 'Tuple', + values: [ + [ + { a: 0, b: true, c: 'hello' }, + { tag: 'First', values: undefined } + ] + ] + }; + roundtrip('complex', complex); }); - describe("complex", () => { - it("struct", () => { - const complex = { - tag: "Struct", - values: [{ a: 0, b: true, c: "hello" }], - }; - roundtrip("complex", complex); - }); - it("tuple", () => { - const complex = { - tag: "Tuple", - values: [ - [ - { a: 0, b: true, c: "hello" }, - { tag: "First", values: undefined }, - ], - ], - }; - roundtrip("complex", complex); - }); - it("enum", () => { - const complex = { - tag: "Enum", - values: [{ tag: "First", values: undefined }], - }; - roundtrip("complex", complex); - }); - it("asset", () => { - const complex = { tag: "Asset", values: [addr, 1n] }; - roundtrip("complex", complex); - }); - it("void", () => { - const complex = { tag: "Void", values: undefined }; - roundtrip("complex", complex); - }); + it('enum', () => { + const complex = { + tag: 'Enum', + values: [{ tag: 'First', values: undefined }] + }; + roundtrip('complex', complex); }); - it("addresse", () => { - roundtrip("addresse", addr); + it('asset', () => { + const complex = { tag: 'Asset', values: [addr, 1n] }; + roundtrip('complex', complex); }); - it("bytes", () => { - const bytes = Buffer.from("hello"); - roundtrip("bytes", bytes); - }); - it("bytes_n", () => { - const bytes_n = Buffer.from("123456789"); // what's the correct way to construct bytes_n? - roundtrip("bytes_n", bytes_n); - }); - it("card", () => { - const card = 11; - roundtrip("card", card); - }); - it("boolean", () => { - roundtrip("boolean", true); - }); - it("not", () => { - roundtrip("boolean", false); - }); - it("i128", () => { - roundtrip("i128", -1n); - }); - it("u128", () => { - roundtrip("u128", 1n); - }); - it("map", () => { - const map = new Map(); - map.set(1, true); - map.set(2, false); - roundtrip("map", map); - map.set(3, "hahaha"); - expect(() => roundtrip("map", map)).to.throw(/invalid type scSpecTypeBool specified for string value/i); - }); - it("vec", () => { - const vec = [1, 2, 3]; - roundtrip("vec", vec); - }); - it("tuple", () => { - const tuple = ["hello", 1]; - roundtrip("tuple", tuple); - }); - it("option", () => { - roundtrip("option", 1); - roundtrip("option", undefined); - }); - it("u256", () => { - roundtrip("u256", 1n); - expect(() => roundtrip("u256", -1n)).to.throw(/expected a positive value, got: -1/i); - }); - it("i256", () => { - roundtrip("i256", -1n); - }); - it("string", () => { - roundtrip("string", "hello"); - }); - it("tuple_strukt", () => { - const arg = [ - { a: 0, b: true, c: "hello" }, - { tag: "First", values: undefined }, - ]; - roundtrip("tuple_strukt", arg); + it('void', () => { + const complex = { tag: 'Void', values: undefined }; + roundtrip('complex', complex); }); + }); + it('addresse', () => { + roundtrip('addresse', addr); + }); + it('bytes', () => { + const bytes = Buffer.from('hello'); + roundtrip('bytes', bytes); + }); + it('bytes_n', () => { + const bytes_n = Buffer.from('123456789'); // what's the correct way to construct bytes_n? + roundtrip('bytes_n', bytes_n); + }); + it('card', () => { + const card = 11; + roundtrip('card', card); + }); + it('boolean', () => { + roundtrip('boolean', true); + }); + it('not', () => { + roundtrip('boolean', false); + }); + it('i128', () => { + roundtrip('i128', -1n); + }); + it('u128', () => { + roundtrip('u128', 1n); + }); + it('map', () => { + const map = new Map(); + map.set(1, true); + map.set(2, false); + roundtrip('map', map); + map.set(3, 'hahaha'); + expect(() => roundtrip('map', map)).to.throw( + /invalid type scSpecTypeBool specified for string value/i + ); + }); + it('vec', () => { + const vec = [1, 2, 3]; + roundtrip('vec', vec); + }); + it('tuple', () => { + const tuple = ['hello', 1]; + roundtrip('tuple', tuple); + }); + it('option', () => { + roundtrip('option', 1); + roundtrip('option', undefined); + }); + it('u256', () => { + roundtrip('u256', 1n); + expect(() => roundtrip('u256', -1n)).to.throw( + /expected a positive value, got: -1/i + ); + }); + it('i256', () => { + roundtrip('i256', -1n); + }); + it('string', () => { + roundtrip('string', 'hello'); + }); + it('tuple_strukt', () => { + const arg = [ + { a: 0, b: true, c: 'hello' }, + { tag: 'First', values: undefined } + ]; + roundtrip('tuple_strukt', arg); + }); }); -describe("parsing and building ScVals", function () { - it("Can parse entries", function () { - let spec = new ContractSpec([GIGA_MAP, func]); - let fn = spec.findEntry("giga_map"); - let gigaMap = spec.findEntry("GigaMap"); - expect(gigaMap).deep.equal(GIGA_MAP); - expect(fn).deep.equal(func); - }); +describe('parsing and building ScVals', function () { + it('Can parse entries', function () { + let spec = new ContractSpec([GIGA_MAP, func]); + let fn = spec.findEntry('giga_map'); + let gigaMap = spec.findEntry('GigaMap'); + expect(gigaMap).deep.equal(GIGA_MAP); + expect(fn).deep.equal(func); + }); }); -export const GIGA_MAP = xdr.ScSpecEntry.scSpecEntryUdtStructV0(new xdr.ScSpecUdtStructV0({ - doc: "This is a kitchen sink of all the types", - lib: "", - name: "GigaMap", +export const GIGA_MAP = xdr.ScSpecEntry.scSpecEntryUdtStructV0( + new xdr.ScSpecUdtStructV0({ + doc: 'This is a kitchen sink of all the types', + lib: '', + name: 'GigaMap', fields: [ - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "bool", - type: xdr.ScSpecTypeDef.scSpecTypeBool(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i128", - type: xdr.ScSpecTypeDef.scSpecTypeI128(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u128", - type: xdr.ScSpecTypeDef.scSpecTypeU128(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i256", - type: xdr.ScSpecTypeDef.scSpecTypeI256(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u256", - type: xdr.ScSpecTypeDef.scSpecTypeU256(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i32", - type: xdr.ScSpecTypeDef.scSpecTypeI32(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u32", - type: xdr.ScSpecTypeDef.scSpecTypeU32(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i64", - type: xdr.ScSpecTypeDef.scSpecTypeI64(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u64", - type: xdr.ScSpecTypeDef.scSpecTypeU64(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "symbol", - type: xdr.ScSpecTypeDef.scSpecTypeSymbol(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "string", - type: xdr.ScSpecTypeDef.scSpecTypeString(), - }), - ], -})); -const GIGA_MAP_TYPE = xdr.ScSpecTypeDef.scSpecTypeUdt(new xdr.ScSpecTypeUdt({ name: "GigaMap" })); -let func = xdr.ScSpecEntry.scSpecEntryFunctionV0(new xdr.ScSpecFunctionV0({ - doc: "Kitchen Sink", - name: "giga_map", + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'bool', + type: xdr.ScSpecTypeDef.scSpecTypeBool() + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'i128', + type: xdr.ScSpecTypeDef.scSpecTypeI128() + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'u128', + type: xdr.ScSpecTypeDef.scSpecTypeU128() + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'i256', + type: xdr.ScSpecTypeDef.scSpecTypeI256() + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'u256', + type: xdr.ScSpecTypeDef.scSpecTypeU256() + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'i32', + type: xdr.ScSpecTypeDef.scSpecTypeI32() + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'u32', + type: xdr.ScSpecTypeDef.scSpecTypeU32() + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'i64', + type: xdr.ScSpecTypeDef.scSpecTypeI64() + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'u64', + type: xdr.ScSpecTypeDef.scSpecTypeU64() + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'symbol', + type: xdr.ScSpecTypeDef.scSpecTypeSymbol() + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: '', + name: 'string', + type: xdr.ScSpecTypeDef.scSpecTypeString() + }) + ] + }) +); +const GIGA_MAP_TYPE = xdr.ScSpecTypeDef.scSpecTypeUdt( + new xdr.ScSpecTypeUdt({ name: 'GigaMap' }) +); +let func = xdr.ScSpecEntry.scSpecEntryFunctionV0( + new xdr.ScSpecFunctionV0({ + doc: 'Kitchen Sink', + name: 'giga_map', inputs: [ - new xdr.ScSpecFunctionInputV0({ - doc: "", - name: "giga_map", - type: GIGA_MAP_TYPE, - }), + new xdr.ScSpecFunctionInputV0({ + doc: '', + name: 'giga_map', + type: GIGA_MAP_TYPE + }) ], - outputs: [GIGA_MAP_TYPE], -})); + outputs: [GIGA_MAP_TYPE] + }) +); diff --git a/test/unit/server/horizon/claimable_balances.js b/test/unit/server/horizon/claimable_balances.js index 12b72f0b9..e4ec38eff 100644 --- a/test/unit/server/horizon/claimable_balances.js +++ b/test/unit/server/horizon/claimable_balances.js @@ -1,8 +1,8 @@ const { HorizonServer } = StellarSdk; -describe('ClaimableBalanceCallBuilder', function () { +describe("ClaimableBalanceCallBuilder", function () { beforeEach(function () { - this.server = new HorizonServer('https://horizon-live.stellar.org:1337'); + this.server = new HorizonServer("https://horizon-live.stellar.org:1337"); this.axiosMock = sinon.mock(HorizonAxiosClient); StellarSdk.Config.setDefault(); }); @@ -12,44 +12,44 @@ describe('ClaimableBalanceCallBuilder', function () { this.axiosMock.restore(); }); - it('requests the correct endpoint', function (done) { + it("requests the correct endpoint", function (done) { let singleBalanceResponse = { _links: { self: { - href: 'horizon-live.stellar.org:1337/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072' - } + href: "horizon-live.stellar.org:1337/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", + }, }, - id: '00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072', - asset: 'native', - amount: '200.0000000', - sponsor: 'GBVFLWXYCIGPO3455XVFIKHS66FCT5AI64ZARKS7QJN4NF7K5FOXTJNL', + id: "00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", + asset: "native", + amount: "200.0000000", + sponsor: "GBVFLWXYCIGPO3455XVFIKHS66FCT5AI64ZARKS7QJN4NF7K5FOXTJNL", last_modified_ledger: 38888, claimants: [ { destination: - 'GBVFLWXYCIGPO3455XVFIKHS66FCT5AI64ZARKS7QJN4NF7K5FOXTJNL', + "GBVFLWXYCIGPO3455XVFIKHS66FCT5AI64ZARKS7QJN4NF7K5FOXTJNL", predicate: { - unconditional: true - } - } + unconditional: true, + }, + }, ], paging_token: - '38888-00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072' + "38888-00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", }; this.axiosMock - .expects('get') + .expects("get") .withArgs( sinon.match( - 'https://horizon-live.stellar.org:1337/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072' - ) + "https://horizon-live.stellar.org:1337/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", + ), ) .returns(Promise.resolve({ data: singleBalanceResponse })); this.server .claimableBalances() .claimableBalance( - '00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072' + "00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", ) .call() .then(function (response) { @@ -65,36 +65,36 @@ describe('ClaimableBalanceCallBuilder', function () { const data = { _links: { self: { - href: 'https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' + href: "https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", }, next: { - href: 'https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' + href: "https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", }, prev: { - href: 'https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc' - } + href: "https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc", + }, }, _embedded: { - records: [] - } + records: [], + }, }; this.axiosMock - .expects('get') + .expects("get") .withArgs( sinon.match( - 'https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' - ) + "https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", + ), ) .returns(Promise.resolve({ data })); this.server .claimableBalances() - .sponsor('GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD') + .sponsor("GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD") .call() .then(function (response) { - expect(response.next).to.be.a('function'); - expect(response.prev).to.be.a('function'); + expect(response.next).to.be.a("function"); + expect(response.prev).to.be.a("function"); done(); }) .catch(function (err) { @@ -106,36 +106,36 @@ describe('ClaimableBalanceCallBuilder', function () { const data = { _links: { self: { - href: 'https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' + href: "https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", }, next: { - href: 'https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' + href: "https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", }, prev: { - href: 'https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc' - } + href: "https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc", + }, }, _embedded: { - records: [] - } + records: [], + }, }; this.axiosMock - .expects('get') + .expects("get") .withArgs( sinon.match( - 'https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' - ) + "https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", + ), ) .returns(Promise.resolve({ data })); this.server .claimableBalances() - .claimant('GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD') + .claimant("GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD") .call() .then(function (response) { - expect(response.next).to.be.a('function'); - expect(response.prev).to.be.a('function'); + expect(response.next).to.be.a("function"); + expect(response.prev).to.be.a("function"); done(); }) .catch(function (err) { @@ -147,26 +147,26 @@ describe('ClaimableBalanceCallBuilder', function () { const data = { _links: { self: { - href: 'https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' + href: "https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", }, next: { - href: 'https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' + href: "https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", }, prev: { - href: 'https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc' - } + href: "https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc", + }, }, _embedded: { - records: [] - } + records: [], + }, }; this.axiosMock - .expects('get') + .expects("get") .withArgs( sinon.match( - 'https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' - ) + "https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", + ), ) .returns(Promise.resolve({ data })); @@ -174,14 +174,14 @@ describe('ClaimableBalanceCallBuilder', function () { .claimableBalances() .asset( new StellarSdk.Asset( - 'USD', - 'GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' - ) + "USD", + "GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", + ), ) .call() .then(function (response) { - expect(response.next).to.be.a('function'); - expect(response.prev).to.be.a('function'); + expect(response.next).to.be.a("function"); + expect(response.prev).to.be.a("function"); done(); }) .catch(function (err) { diff --git a/test/unit/server/horizon/join_test.js b/test/unit/server/horizon/join_test.js index 019b98add..2158e0be6 100644 --- a/test/unit/server/horizon/join_test.js +++ b/test/unit/server/horizon/join_test.js @@ -1,8 +1,8 @@ const { HorizonServer } = StellarSdk; -describe('Server - CallBuilder#join', function () { +describe("Server - CallBuilder#join", function () { beforeEach(function () { - this.server = new HorizonServer('https://horizon-live.stellar.org:1337'); + this.server = new HorizonServer("https://horizon-live.stellar.org:1337"); this.axiosMock = sinon.mock(HorizonAxiosClient); }); @@ -11,151 +11,151 @@ describe('Server - CallBuilder#join', function () { this.axiosMock.restore(); }); - describe('#join', function () { + describe("#join", function () { const transaction = { - memo: '', + memo: "", _links: { self: { - href: 'https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5' + href: "https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5", }, account: { - href: 'https://horizon-live.stellar.org:1337/accounts/GBIABVWR2LOKFDMAI6QA2NGT4G54O3BC577GAWDQ6QMOUP5E3ULBBGYX' + href: "https://horizon-live.stellar.org:1337/accounts/GBIABVWR2LOKFDMAI6QA2NGT4G54O3BC577GAWDQ6QMOUP5E3ULBBGYX", }, ledger: { - href: 'https://horizon-live.stellar.org:1337/ledgers/679846' + href: "https://horizon-live.stellar.org:1337/ledgers/679846", }, operations: { - href: 'https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5/operations{?cursor,limit,order}', - templated: true + href: "https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5/operations{?cursor,limit,order}", + templated: true, }, effects: { - href: 'https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5/effects{?cursor,limit,order}', - templated: true + href: "https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5/effects{?cursor,limit,order}", + templated: true, }, precedes: { - href: 'https://horizon-live.stellar.org:1337/transactions?order=asc\u0026cursor=2919916336320512' + href: "https://horizon-live.stellar.org:1337/transactions?order=asc\u0026cursor=2919916336320512", }, succeeds: { - href: 'https://horizon-live.stellar.org:1337/transactions?order=desc\u0026cursor=2919916336320512' - } + href: "https://horizon-live.stellar.org:1337/transactions?order=desc\u0026cursor=2919916336320512", + }, }, - id: 'de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5', - paging_token: '2919916336320512', + id: "de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5", + paging_token: "2919916336320512", successful: true, - hash: 'de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5', + hash: "de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5", ledger: 679846, - created_at: '2019-09-12T14:24:35Z', + created_at: "2019-09-12T14:24:35Z", source_account: - 'GBIABVWR2LOKFDMAI6QA2NGT4G54O3BC577GAWDQ6QMOUP5E3ULBBGYX', - source_account_sequence: '2954696981479425', + "GBIABVWR2LOKFDMAI6QA2NGT4G54O3BC577GAWDQ6QMOUP5E3ULBBGYX", + source_account_sequence: "2954696981479425", fee_charged: 3600, max_fee: 3600, operation_count: 6, envelope_xdr: - 'AAAAAFAA1tHS3KKNgEegDTTT4bvHbCLv/mBYcPQY6j+k3RYQAAAOEAAKf0gAAAABAAAAAAAAAAEAAAAAAAAABgAAAAEAAAAA/vzW27XUS0+Xg+vfq2MERAh2+SdzYshzMcLIcp/NsWwAAAABAAAAAIiGNYyweZIad3hrO4nQqK61U0Rs38vKAESO3qPAncsGAAAAATE4AAAAAAAA/vzW27XUS0+Xg+vfq2MERAh2+SdzYshzMcLIcp/NsWwAAAAAAAAAAwAAAAEAAAAA/vzW27XUS0+Xg+vfq2MERAh2+SdzYshzMcLIcp/NsWwAAAAGAAAAAmJvbmRTaGFyZQAAAAAAAACTGdj4LvjCooulIWoF2ATREiHt8CUE0zFcoY2AYifc9nU43Pt1hkEAAAAAAQAAAABQANbR0tyijYBHoA000+G7x2wi7/5gWHD0GOo/pN0WEAAAAAEAAAAA/vzW27XUS0+Xg+vfq2MERAh2+SdzYshzMcLIcp/NsWwAAAACYm9uZFNoYXJlAAAAAAAAAJMZ2Pgu+MKii6UhagXYBNESIe3wJQTTMVyhjYBiJ9z2AAAAF0h26AAAAAABAAAAAFAA1tHS3KKNgEegDTTT4bvHbCLv/mBYcPQY6j+k3RYQAAAACgAAAB9ySTogICAgICAgM1E5MFVTRCAgICAgICAzUTkwVVNEAAAAAAAAAAABAAAAAFAA1tHS3KKNgEegDTTT4bvHbCLv/mBYcPQY6j+k3RYQAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAADBqFM6zp4S5rWyOHbBzm9AiebKnFa4dy+9cld3GrQbGQAAAP8AAAABAAAAAP781tu11EtPl4Pr36tjBEQIdvknc2LIczHCyHKfzbFsAAAAAgAAAAFVU0QAAAAAAG5o7FuqrASKyy/Xfs1y4q0FPUniqOT6fmkDFwPanOlGAAAAF0h26AAAA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AAAd6MoFWveXL4F+nT98egtIDeglk7w3jw5I+DuOMZheTlAAAAGAAAAAAAAAAA", + memo_type: "text", signatures: [ - '5QcaEgzj+krAtiH0+iRho6gjxWIUMkTfVo28FqoBqlraePffIIDL7TiJN1gMrdZxiBTrsAJvpRqoJtmjEjL8AQ==' - ] + "5QcaEgzj+krAtiH0+iRho6gjxWIUMkTfVo28FqoBqlraePffIIDL7TiJN1gMrdZxiBTrsAJvpRqoJtmjEjL8AQ==", + ], }; const operationsResponse = { _links: { self: { - href: 'https://horizon-live.stellar.org:1337/operations?cursor=\u0026join=transactions\u0026limit=10\u0026order=asc' + href: "https://horizon-live.stellar.org:1337/operations?cursor=\u0026join=transactions\u0026limit=10\u0026order=asc", }, next: { - href: 'https://horizon-live.stellar.org:1337/operations?cursor=2919916336320518\u0026join=transactions\u0026limit=10\u0026order=asc' + href: "https://horizon-live.stellar.org:1337/operations?cursor=2919916336320518\u0026join=transactions\u0026limit=10\u0026order=asc", }, prev: { - href: 'https://horizon-live.stellar.org:1337/operations?cursor=2919916336320518\u0026join=transactions\u0026limit=1\u0026order=asc' - } + href: "https://horizon-live.stellar.org:1337/operations?cursor=2919916336320518\u0026join=transactions\u0026limit=1\u0026order=asc", + }, }, _embedded: { records: [ { _links: { self: { - href: 'https://horizon-live.stellar.org:1337/operations/2919916336320518' + href: "https://horizon-live.stellar.org:1337/operations/2919916336320518", }, transaction: { - href: 'https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5' + href: "https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5", }, effects: { - href: 'https://horizon-live.stellar.org:1337/operations/2919916336320518/effects' + href: "https://horizon-live.stellar.org:1337/operations/2919916336320518/effects", }, succeeds: { - href: 'https://horizon-live.stellar.org:1337/effects?order=desc\u0026cursor=2919916336320518' + href: "https://horizon-live.stellar.org:1337/effects?order=desc\u0026cursor=2919916336320518", }, precedes: { - href: 'https://horizon-live.stellar.org:1337/effects?order=asc\u0026cursor=2919916336320518' - } + href: "https://horizon-live.stellar.org:1337/effects?order=asc\u0026cursor=2919916336320518", + }, }, - id: '2919916336320518', - paging_token: '2919916336320518', + id: "2919916336320518", + paging_token: "2919916336320518", transaction_successful: true, source_account: - 'GD7PZVW3WXKEWT4XQPV57K3DARCAQ5XZE5ZWFSDTGHBMQ4U7ZWYWZLPC', - type: 'path_payment', + "GD7PZVW3WXKEWT4XQPV57K3DARCAQ5XZE5ZWFSDTGHBMQ4U7ZWYWZLPC", + type: "path_payment", type_i: 2, - created_at: '2019-09-12T14:24:35Z', + created_at: "2019-09-12T14:24:35Z", transaction_hash: - 'de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5', + "de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5", transaction, - asset_type: 'credit_alphanum4', - asset_code: 'USD', + asset_type: "credit_alphanum4", + asset_code: "USD", asset_issuer: - 'GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD', - from: 'GD7PZVW3WXKEWT4XQPV57K3DARCAQ5XZE5ZWFSDTGHBMQ4U7ZWYWZLPC', - to: 'GCC3LGXHBZ6NSJOJCETNRRYTNDQJGCRC3P7YC2ZQ2ER3YWVJJQ2YDUL7', - amount: '10000.0000000', + "GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD", + from: "GD7PZVW3WXKEWT4XQPV57K3DARCAQ5XZE5ZWFSDTGHBMQ4U7ZWYWZLPC", + to: "GCC3LGXHBZ6NSJOJCETNRRYTNDQJGCRC3P7YC2ZQ2ER3YWVJJQ2YDUL7", + amount: "10000.0000000", path: [ { - asset_type: 'credit_alphanum4', - asset_code: 'USD', + asset_type: "credit_alphanum4", + asset_code: "USD", asset_issuer: - 'GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD' + "GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD", }, { - asset_type: 'credit_alphanum4', - asset_code: 'USD', + asset_type: "credit_alphanum4", + asset_code: "USD", asset_issuer: - 'GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD' - } + "GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD", + }, ], - source_amount: '10000.0000000', - source_max: '10000.0000000', - source_asset_type: 'credit_alphanum4', - source_asset_code: 'USD', + source_amount: "10000.0000000", + source_max: "10000.0000000", + source_asset_type: "credit_alphanum4", + source_asset_code: "USD", source_asset_issuer: - 'GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD' - } - ] - } + "GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD", + }, + ], + }, }; - it('loads resources in join and avoids extra call to server', function (done) { + it("loads resources in join and avoids extra call to server", function (done) { this.axiosMock - .expects('get') + .expects("get") .withArgs( sinon.match( - 'https://horizon-live.stellar.org:1337/operations?join=transactions' - ) + "https://horizon-live.stellar.org:1337/operations?join=transactions", + ), ) .returns(Promise.resolve({ data: operationsResponse })); this.server .operations() - .join('transactions') + .join("transactions") .call() .then((response) => { const record = response.records[0]; - expect(record.transaction).to.be.a('function'); + expect(record.transaction).to.be.a("function"); record.transaction().then((transaction) => { expect(transaction).to.deep.equal(transaction);