Skip to content

Commit

Permalink
Simplify the array accessor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nene committed Nov 13, 2023
1 parent a796b75 commit 9687adb
Showing 1 changed file with 5 additions and 26 deletions.
31 changes: 5 additions & 26 deletions test/features/arrayAndMapAccessors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,35 +59,14 @@ export default function supportsArrayAndMapAccessors(format: FormatFn) {
`);
});

it('supports namespaced array identifiers in uppercase', () => {
const result = format(`SELECT Foo.Coalesce['Blah'];`, { identifierCase: 'upper' });
expect(result).toBe(dedent`
it('changes case of array accessors when identifierCase option used', () => {
expect(format(`SELECT arr[1];`, { identifierCase: 'upper' })).toBe(dedent`
SELECT
FOO.COALESCE['Blah'];
ARR[1];
`);
});

it('supports namespaced array identifiers in lowercase', () => {
const result = format(`SELECT Foo.Coalesce['Blah'];`, { identifierCase: 'lower' });
expect(result).toBe(dedent`
expect(format(`SELECT NS.Arr[1];`, { identifierCase: 'lower' })).toBe(dedent`
SELECT
foo.coalesce['Blah'];
`);
});

it('formats namespaced array accessor with comment in-between in uppercase', () => {
const result = format(`SELECT foo./* comment */arr[1];`, { identifierCase: 'upper' });
expect(result).toBe(dedent`
SELECT
FOO./* comment */ ARR[1];
`);
});

it('formats namespaced array accessor with comment in-between in lowercase', () => {
const result = format(`SELECT Foo./* comment */Arr[1];`, { identifierCase: 'lower' });
expect(result).toBe(dedent`
SELECT
foo./* comment */ arr[1];
ns.arr[1];
`);
});
}

0 comments on commit 9687adb

Please sign in to comment.