Skip to content

Commit

Permalink
chore: add test-cases for array extraction (#30)
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Sankeerth <sanpj2292@github.com>
Co-authored-by: Sai Sankeerth <sanpj2292@github.com>
  • Loading branch information
sanpj2292 and Sai Sankeerth authored Jun 26, 2023
1 parent 09779c6 commit 7c1ee4b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/scenarios/conditions/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,25 @@ export const data: Scenario[] = [
},
output: 15,
},
{
templatePath: 'undefined-arr-cond.jt',
input: {
products: [{ a: 1 }, { a: 2 }],
},
output: 'no',
},
{
templatePath: 'undefined-arr-cond.jt',
input: {
products: [{ objectID: 1 }, { objectID: 2 }],
},
output: 'yes',
},
{
templatePath: 'undefined-arr-cond.jt',
input: {
otherProperty: [{ objectID: 1 }, { objectID: 2 }],
},
output: 'no',
},
];
2 changes: 2 additions & 0 deletions test/scenarios/conditions/undefined-arr-cond.jt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let a = ~r .products.objectID;
Array.isArray(a) ? "yes":"no";

0 comments on commit 7c1ee4b

Please sign in to comment.