Skip to content

Commit

Permalink
Fix join tests - 'id' is a reserved word in db2i
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjorgensen committed Nov 9, 2023
1 parent 6802136 commit dd91db1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/features/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,43 +42,43 @@ export default function supportsJoin(
const result = format(`
SELECT * FROM customers
${join} orders ON customers.customer_id = orders.customer_id
${join} items ON items.id = orders.id;
${join} items ON items.col1 = orders.col1;
`);
expect(result).toBe(dedent`
SELECT
*
FROM
customers
${join} orders ON customers.customer_id = orders.customer_id
${join} items ON items.id = orders.id;
${join} items ON items.col1 = orders.col1;
`);
});
});

it('properly uppercases JOIN ... ON', () => {
const result = format(`select * from customers join foo on foo.id = customers.id;`, {
const result = format(`select * from customers join foo on foo.col1 = customers.col1;`, {
keywordCase: 'upper',
});
expect(result).toBe(dedent`
SELECT
*
FROM
customers
JOIN foo ON foo.id = customers.id;
JOIN foo ON foo.col1 = customers.col1;
`);
});

if (supportsUsing) {
it('properly uppercases JOIN ... USING', () => {
const result = format(`select * from customers join foo using (id);`, {
const result = format(`select * from customers join foo using (col1);`, {
keywordCase: 'upper',
});
expect(result).toBe(dedent`
SELECT
*
FROM
customers
JOIN foo USING (id);
JOIN foo USING (col1);
`);
});
}
Expand All @@ -87,13 +87,13 @@ export default function supportsJoin(
['CROSS APPLY', 'OUTER APPLY'].forEach(apply => {
// TODO: improve formatting of custom functions
it(`supports ${apply}`, () => {
const result = format(`SELECT * FROM customers ${apply} fn(customers.id)`);
const result = format(`SELECT * FROM customers ${apply} fn(customers.col1)`);
expect(result).toBe(dedent`
SELECT
*
FROM
customers
${apply} fn (customers.id)
${apply} fn (customers.col1)
`);
});
});
Expand Down

0 comments on commit dd91db1

Please sign in to comment.