Merge pull request #38 from h-sphere/chore/adding-more-tests

chore: adding more tests and reworking jest globals
This commit is contained in:
Kacper Kula 2025-01-15 20:13:17 +00:00 committed by GitHub
commit 79258ebd1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 28 additions and 10 deletions

View file

@ -19,7 +19,6 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.14",
"@types/lodash": "^4.17.13",
"@types/node": "^22.9.3",

View file

@ -51,9 +51,6 @@ importers:
specifier: ^11.0.4
version: 11.0.4
devDependencies:
'@jest/globals':
specifier: ^29.7.0
version: 29.7.0
'@types/jest':
specifier: ^29.5.14
version: 29.5.14

View file

@ -1,4 +1,3 @@
import { describe, it, expect } from '@jest/globals'
import { parseLanguage } from './newParser'
@ -73,6 +72,14 @@ select * from files`)).toEqual({
"queryPart": "select * from files",
"tables": [],
})
expect(parseLanguage(`
html
select * from files`)).toEqual({
"intermediateContent": "html",
"queryPart": "select * from files",
"tables": [],
})
})
it('should properly parse query where SELECT is in sPoNgeBoB-cAsE', () => {
@ -105,4 +112,19 @@ sElEcT * fRoM files`)).toEqual({
]
})
})
it('should properly parse query with just table and sql syntax', () => {
const q = `table x = file(aaa.csv)
select * from x`
expect(parseLanguage(q)).toEqual({
queryPart: 'select * from x',
intermediateContent: '',
tables: [
{
tableName: 'x',
fileName: 'aaa.csv'
}
]
})
})
})

View file

@ -1,4 +1,3 @@
import { describe, it, expect } from '@jest/globals'
import { transformQuery } from './sqlTransformer'

View file

@ -1,4 +1,3 @@
import { describe, it, expect } from '@jest/globals'
import { predictJson, predictType } from './typePredictions'
describe('Utils', () => {

View file

@ -11,8 +11,10 @@
"importHelpers": false,
"isolatedModules": true,
"skipLibCheck": true,
"types": [],
"strictNullChecks": true,
"types": [
"jest"
],
"strictNullChecks": true,
"lib": [
"DOM",
"ES5",
@ -24,4 +26,4 @@
"include": [
"**/*.ts"
]
}
}