Skip to content

Commit

Permalink
fix: constructKey meta mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
dolcalmi committed Jan 29, 2022
1 parent ddb8c4e commit 64ab0b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions spec/balance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,11 @@ describe("balance model", function () {
expect(res.results[0].meta).to.have.property("otherMeta");
expect(res.results[0].meta).to.not.have.property("clientId");

const snapshot = await getBestSnapshot({ book: book.name, account, clientId, otherMeta });
expect(snapshot).to.have.property("balance", 1);
const snapshot1 = await getBestSnapshot({ book: book.name, account, clientId, meta: { otherMeta } });
expect(snapshot1).to.have.property("balance", 1);

const snapshot2 = await getBestSnapshot({ book: book.name, account, clientId, otherMeta });
expect(snapshot2).to.have.property("balance", 1);
});
});
});
1 change: 1 addition & 0 deletions src/models/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function constructKey(book: string, account?: string, meta?: IAnyObject):
book,
account,
Object.entries(flattenObject(meta, "", true))
.sort()
.map(([key, value]) => key + ":" + value)
.join(),
]
Expand Down

0 comments on commit 64ab0b4

Please sign in to comment.