Skip to content

Commit a9d9e00

Browse files
committed
Add test case for #575 with classes
1 parent c55d38b commit a9d9e00

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/test/05-aql-queries.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,22 @@ describe("AQL queries", function() {
176176
expect(Object.keys(query.bindVars)).to.eql(["value0"]);
177177
expect(query.bindVars.value0).to.equal(whatever);
178178
});
179+
it("supports arbitrary classes", () => {
180+
class Whatever {
181+
color: string;
182+
constructor(color: string) {
183+
this.color = color;
184+
}
185+
}
186+
const whatever: Whatever[] = [
187+
new Whatever("green"),
188+
new Whatever("yellow")
189+
];
190+
const query = aql`${whatever}`;
191+
expect(query.query).to.equal("@value0");
192+
expect(Object.keys(query.bindVars)).to.eql(["value0"]);
193+
expect(query.bindVars.value0).to.equal(whatever);
194+
});
179195
it("supports AQL literals", () => {
180196
const query = aql`FOR x IN whatever ${aql.literal(
181197
"FILTER x.blah"

0 commit comments

Comments
 (0)