From c8e6352afa69a6a629508e6c73b59bc7a7052479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=90=89=E6=98=93?= Date: Thu, 1 Aug 2024 09:34:10 +0800 Subject: [PATCH] fix: spell check (#337) Co-authored-by: liuyi --- CHANGELOG.md | 2 +- test/jest.d.ts | 6 +++--- test/matchers.ts | 2 +- .../flink/suggestion/tokenSuggestion.test.ts | 6 +++--- .../hive/suggestion/tokenSuggestion.test.ts | 20 +++++++++---------- .../impala/suggestion/tokenSuggestion.test.ts | 10 +++++----- .../mysql/suggestion/tokenSuggestion.test.ts | 16 +++++++-------- .../suggestion/tokenSuggestion.test.ts | 10 +++++----- .../spark/suggestion/tokenSuggestion.test.ts | 18 ++++++++--------- .../trino/suggestion/tokenSuggestion.test.ts | 12 +++++------ test/setupTests.ts | 4 ++-- 11 files changed, 53 insertions(+), 53 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67823fa9..c3054c6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,7 +61,7 @@ All notable changes to this project will be documented in this file. See [standa ### Features -* add toMatchUnorderedArrary matcher and apply it ([#271](https://github.com/DTStack/dt-sql-parser/issues/271)) ([a05f099](https://github.com/DTStack/dt-sql-parser/commit/a05f099aa1ad555c408bc2018240fb4611ec09b8)) +* add toMatchUnorderedArray matcher and apply it ([#271](https://github.com/DTStack/dt-sql-parser/issues/271)) ([a05f099](https://github.com/DTStack/dt-sql-parser/commit/a05f099aa1ad555c408bc2018240fb4611ec09b8)) * collect entity ([#265](https://github.com/DTStack/dt-sql-parser/issues/265)) ([a997211](https://github.com/DTStack/dt-sql-parser/commit/a99721162be0d463b513f53bb13ada6d10168548)), closes [#256](https://github.com/DTStack/dt-sql-parser/issues/256) [#263](https://github.com/DTStack/dt-sql-parser/issues/263) [#268](https://github.com/DTStack/dt-sql-parser/issues/268) * migrate to antlr4ng ([#267](https://github.com/DTStack/dt-sql-parser/issues/267)) ([195878d](https://github.com/DTStack/dt-sql-parser/commit/195878da9bb1ff8011b5d60c02389fa66d2bc0b8)) * **spark:** support materialized view for spark sql ([#262](https://github.com/DTStack/dt-sql-parser/issues/262)) ([5ce89cb](https://github.com/DTStack/dt-sql-parser/commit/5ce89cb421de18330d56e23a4ab5b658b2130a0b)) diff --git a/test/jest.d.ts b/test/jest.d.ts index 56a6dcae..ee98c31d 100644 --- a/test/jest.d.ts +++ b/test/jest.d.ts @@ -9,9 +9,9 @@ namespace jest { * Every item must be primitive type, like string, number, etc. * * @example - * expect(['a', 'b']).toMatchUnorderedArrary(['b', 'a']) // pass - * expect(['b', 'a']).toMatchUnorderedArrary(['c', 'b', 'a']) // not pass, missing item 'c' + * expect(['a', 'b']).toMatchUnorderedArray(['b', 'a']) // pass + * expect(['b', 'a']).toMatchUnorderedArray(['c', 'b', 'a']) // not pass, missing item 'c' */ - toMatchUnorderedArrary(expected: unknown[]): R; + toMatchUnorderedArray(expected: unknown[]): R; } } diff --git a/test/matchers.ts b/test/matchers.ts index 66cb5d81..c37ade47 100644 --- a/test/matchers.ts +++ b/test/matchers.ts @@ -1,4 +1,4 @@ -export const toMatchUnorderedArrary: jest.CustomMatcher = function ( +export const toMatchUnorderedArray: jest.CustomMatcher = function ( actual: Array, expected: Array ) { diff --git a/test/parser/flink/suggestion/tokenSuggestion.test.ts b/test/parser/flink/suggestion/tokenSuggestion.test.ts index e527d6b8..6663d174 100644 --- a/test/parser/flink/suggestion/tokenSuggestion.test.ts +++ b/test/parser/flink/suggestion/tokenSuggestion.test.ts @@ -19,7 +19,7 @@ describe('Flink SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['MODULES', 'CATALOG']); + expect(suggestion).toMatchUnorderedArray(['MODULES', 'CATALOG']); }); test('Create Statement ', () => { @@ -32,7 +32,7 @@ describe('Flink SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'CATALOG', 'FUNCTION', 'TEMPORARY', @@ -52,7 +52,7 @@ describe('Flink SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'MODULES', 'FULL', 'FUNCTIONS', diff --git a/test/parser/hive/suggestion/tokenSuggestion.test.ts b/test/parser/hive/suggestion/tokenSuggestion.test.ts index 106d3ff9..06c0e3d9 100644 --- a/test/parser/hive/suggestion/tokenSuggestion.test.ts +++ b/test/parser/hive/suggestion/tokenSuggestion.test.ts @@ -18,7 +18,7 @@ describe('Hive SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'APPLICATION', 'GROUP', 'USER', @@ -45,7 +45,7 @@ describe('Hive SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'CONNECTOR', 'APPLICATION', 'GROUP', @@ -80,7 +80,7 @@ describe('Hive SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['FROM']); + expect(suggestion).toMatchUnorderedArray(['FROM']); }); test('After DESCRIBE', () => { @@ -92,7 +92,7 @@ describe('Hive SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'EXTENDED', 'FORMATTED', 'FUNCTION', @@ -111,7 +111,7 @@ describe('Hive SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'CONNECTOR', 'APPLICATION', 'GROUP', @@ -141,7 +141,7 @@ describe('Hive SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['TABLE']); + expect(suggestion).toMatchUnorderedArray(['TABLE']); }); test('After IMPORT', () => { @@ -153,7 +153,7 @@ describe('Hive SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['FROM', 'TABLE', 'EXTERNAL']); + expect(suggestion).toMatchUnorderedArray(['FROM', 'TABLE', 'EXTERNAL']); }); test('After INSERT', () => { @@ -165,7 +165,7 @@ describe('Hive SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['INTO', 'OVERWRITE']); + expect(suggestion).toMatchUnorderedArray(['INTO', 'OVERWRITE']); }); test('After LOAD', () => { @@ -177,7 +177,7 @@ describe('Hive SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['DATA']); + expect(suggestion).toMatchUnorderedArray(['DATA']); }); test('After SHOW', () => { @@ -189,7 +189,7 @@ describe('Hive SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'CURRENT', 'ROLES', 'PRINCIPALS', diff --git a/test/parser/impala/suggestion/tokenSuggestion.test.ts b/test/parser/impala/suggestion/tokenSuggestion.test.ts index 26d565ce..627d7293 100644 --- a/test/parser/impala/suggestion/tokenSuggestion.test.ts +++ b/test/parser/impala/suggestion/tokenSuggestion.test.ts @@ -19,7 +19,7 @@ describe('Impala SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['TABLE', 'VIEW', 'DATABASE']); + expect(suggestion).toMatchUnorderedArray(['TABLE', 'VIEW', 'DATABASE']); }); test('After CREATE', () => { @@ -32,7 +32,7 @@ describe('Impala SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'TABLE', 'EXTERNAL', 'VIEW', @@ -54,7 +54,7 @@ describe('Impala SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'DATABASE', 'SCHEMA', 'TABLE', @@ -77,7 +77,7 @@ describe('Impala SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['INTO', 'OVERWRITE']); + expect(suggestion).toMatchUnorderedArray(['INTO', 'OVERWRITE']); }); test('After SHOW', () => { @@ -90,7 +90,7 @@ describe('Impala SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'DATABASES', 'SCHEMAS', 'TABLES', diff --git a/test/parser/mysql/suggestion/tokenSuggestion.test.ts b/test/parser/mysql/suggestion/tokenSuggestion.test.ts index 38ca340b..2c913cff 100644 --- a/test/parser/mysql/suggestion/tokenSuggestion.test.ts +++ b/test/parser/mysql/suggestion/tokenSuggestion.test.ts @@ -19,7 +19,7 @@ describe('MySQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'RESOURCE', 'USER', 'VIEW', @@ -50,7 +50,7 @@ describe('MySQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'RESOURCE', 'USER', 'ROLE', @@ -92,7 +92,7 @@ describe('MySQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['FROM', 'IGNORE', 'QUICK', 'LOW_PRIORITY']); + expect(suggestion).toMatchUnorderedArray(['FROM', 'IGNORE', 'QUICK', 'LOW_PRIORITY']); }); test('After DESCRIBE', () => { @@ -105,7 +105,7 @@ describe('MySQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'ANALYZE', 'SELECT', 'DELETE', @@ -129,7 +129,7 @@ describe('MySQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'RESOURCE', 'USER', 'PREPARE', @@ -162,7 +162,7 @@ describe('MySQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'INTO', 'IGNORE', 'DELAYED', @@ -181,7 +181,7 @@ describe('MySQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['INDEX', 'XML', 'DATA']); + expect(suggestion).toMatchUnorderedArray(['INDEX', 'XML', 'DATA']); }); test('After SHOW', () => { @@ -194,7 +194,7 @@ describe('MySQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'REPLICAS', 'REPLICA', 'SLAVE', diff --git a/test/parser/postgresql/suggestion/tokenSuggestion.test.ts b/test/parser/postgresql/suggestion/tokenSuggestion.test.ts index de51ac99..32bd8479 100644 --- a/test/parser/postgresql/suggestion/tokenSuggestion.test.ts +++ b/test/parser/postgresql/suggestion/tokenSuggestion.test.ts @@ -17,7 +17,7 @@ describe('Postgres SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'TYPE', 'TEXT', 'STATISTICS', @@ -66,7 +66,7 @@ describe('Postgres SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'RECURSIVE', 'VIEW', 'TEMPORARY', @@ -126,7 +126,7 @@ describe('Postgres SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['FROM']); + expect(suggestion).toMatchUnorderedArray(['FROM']); }); test('After DROP', () => { @@ -138,7 +138,7 @@ describe('Postgres SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'OPERATOR', 'ROUTINE', 'PROCEDURE', @@ -188,6 +188,6 @@ describe('Postgres SQL Token Suggestion', () => { commentOtherLine(tokenSql, pos.lineNumber), pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['INTO']); + expect(suggestion).toMatchUnorderedArray(['INTO']); }); }); diff --git a/test/parser/spark/suggestion/tokenSuggestion.test.ts b/test/parser/spark/suggestion/tokenSuggestion.test.ts index b3648ddc..4cfd9eda 100644 --- a/test/parser/spark/suggestion/tokenSuggestion.test.ts +++ b/test/parser/spark/suggestion/tokenSuggestion.test.ts @@ -19,7 +19,7 @@ describe('Spark SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'TABLE', 'INDEX', 'VIEW', @@ -40,7 +40,7 @@ describe('Spark SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'TEMPORARY', 'INDEX', 'ROLE', @@ -67,7 +67,7 @@ describe('Spark SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['FROM']); + expect(suggestion).toMatchUnorderedArray(['FROM']); }); test('After DESCRIBE', () => { @@ -80,7 +80,7 @@ describe('Spark SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'WITH', 'SELECT', 'MAP', @@ -106,7 +106,7 @@ describe('Spark SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'TEMPORARY', 'INDEX', 'ROLE', @@ -130,7 +130,7 @@ describe('Spark SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['OVERWRITE', 'INTO']); + expect(suggestion).toMatchUnorderedArray(['OVERWRITE', 'INTO']); }); test('After LOAD', () => { @@ -143,7 +143,7 @@ describe('Spark SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['DATA']); + expect(suggestion).toMatchUnorderedArray(['DATA']); }); test('After SHOW', () => { @@ -156,7 +156,7 @@ describe('Spark SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'LOCKS', 'INDEXES', 'TRANSACTIONS', @@ -195,6 +195,6 @@ describe('Spark SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['TABLE']); + expect(suggestion).toMatchUnorderedArray(['TABLE']); }); }); diff --git a/test/parser/trino/suggestion/tokenSuggestion.test.ts b/test/parser/trino/suggestion/tokenSuggestion.test.ts index 9c8d7d02..d7398dc2 100644 --- a/test/parser/trino/suggestion/tokenSuggestion.test.ts +++ b/test/parser/trino/suggestion/tokenSuggestion.test.ts @@ -19,7 +19,7 @@ describe('Trino SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['VIEW', 'MATERIALIZED', 'TABLE', 'SCHEMA']); + expect(suggestion).toMatchUnorderedArray(['VIEW', 'MATERIALIZED', 'TABLE', 'SCHEMA']); }); test('After CREATE', () => { @@ -32,7 +32,7 @@ describe('Trino SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'ROLE', 'FUNCTION', 'OR', @@ -54,7 +54,7 @@ describe('Trino SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['PREPARE']); + expect(suggestion).toMatchUnorderedArray(['PREPARE']); }); test('After DELETE', () => { @@ -67,7 +67,7 @@ describe('Trino SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['FROM']); + expect(suggestion).toMatchUnorderedArray(['FROM']); }); test('After DESCRIBE', () => { @@ -101,7 +101,7 @@ describe('Trino SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary([ + expect(suggestion).toMatchUnorderedArray([ 'ROLE', 'FUNCTION', 'VIEW', @@ -122,6 +122,6 @@ describe('Trino SQL Token Suggestion', () => { pos )?.keywords; - expect(suggestion).toMatchUnorderedArrary(['INTO']); + expect(suggestion).toMatchUnorderedArray(['INTO']); }); }); diff --git a/test/setupTests.ts b/test/setupTests.ts index 96a90e5e..30459ab3 100644 --- a/test/setupTests.ts +++ b/test/setupTests.ts @@ -1,3 +1,3 @@ -import { toMatchUnorderedArrary } from './matchers'; +import { toMatchUnorderedArray } from './matchers'; -expect.extend({ toMatchUnorderedArrary }); +expect.extend({ toMatchUnorderedArray });