mirror of
https://github.com/asadbek064/hyparquet.git
synced 2025-12-06 06:51:54 +00:00
Test each file instead of all files
This commit is contained in:
parent
ada7429685
commit
cfaa0bca90
12
package.json
12
package.json
@ -27,14 +27,14 @@
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "20.11.19",
|
||||
"@typescript-eslint/eslint-plugin": "7.0.1",
|
||||
"@vitest/coverage-v8": "1.3.0",
|
||||
"eslint": "8.56.0",
|
||||
"@types/node": "20.11.20",
|
||||
"@typescript-eslint/eslint-plugin": "7.0.2",
|
||||
"@vitest/coverage-v8": "1.3.1",
|
||||
"eslint": "8.57.0",
|
||||
"eslint-plugin-import": "2.29.1",
|
||||
"eslint-plugin-jsdoc": "48.1.0",
|
||||
"eslint-plugin-jsdoc": "48.2.0",
|
||||
"http-server": "14.1.1",
|
||||
"typescript": "5.3.3",
|
||||
"vitest": "1.3.0"
|
||||
"vitest": "1.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,17 +4,17 @@ import { parquetMetadata, parquetMetadataAsync } from '../src/hyparquet.js'
|
||||
import { toJson } from '../src/toJson.js'
|
||||
import { fileToAsyncBuffer, fileToJson, readFileToArrayBuffer } from './helpers.js'
|
||||
|
||||
const files = fs.readdirSync('test/files').filter(f => f.endsWith('.parquet'))
|
||||
|
||||
describe('parquetMetadata', () => {
|
||||
it('should parse metadata from all test files', async () => {
|
||||
const files = fs.readdirSync('test/files')
|
||||
for (const file of files) {
|
||||
if (!file.endsWith('.parquet')) continue
|
||||
files.forEach(file => {
|
||||
it(`should parse metadata from ${file}`, async () => {
|
||||
const arrayBuffer = await readFileToArrayBuffer(`test/files/${file}`)
|
||||
const result = toJson(parquetMetadata(arrayBuffer))
|
||||
const base = file.replace('.parquet', '')
|
||||
const expected = fileToJson(`test/files/${base}.metadata.json`)
|
||||
expect(result, JSON.stringify(result, null, 2)).toEqual(expected)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should throw an error for a too short file', () => {
|
||||
@ -46,16 +46,14 @@ describe('parquetMetadata', () => {
|
||||
})
|
||||
|
||||
describe('parquetMetadataAsync', () => {
|
||||
it('should parse metadata asynchronously from all test files', async () => {
|
||||
const files = fs.readdirSync('test/files')
|
||||
for (const file of files) {
|
||||
if (!file.endsWith('.parquet')) continue
|
||||
files.forEach(file => {
|
||||
it(`should parse metadata async from ${file}`, async () => {
|
||||
const asyncBuffer = fileToAsyncBuffer(`test/files/${file}`)
|
||||
const result = await parquetMetadataAsync(asyncBuffer)
|
||||
const base = file.replace('.parquet', '')
|
||||
const expected = fileToJson(`test/files/${base}.metadata.json`)
|
||||
expect(toJson(result)).toEqual(expected)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('should throw an error for invalid magic number', () => {
|
||||
|
||||
@ -5,10 +5,10 @@ import { toJson } from '../src/toJson.js'
|
||||
import { fileToAsyncBuffer, fileToJson } from './helpers.js'
|
||||
|
||||
describe('parquetRead', () => {
|
||||
it('should parse data from all test files', async () => {
|
||||
const files = fs.readdirSync('test/files')
|
||||
for (const file of files) {
|
||||
if (!file.endsWith('.parquet')) continue
|
||||
const files = fs.readdirSync('test/files').filter(f => f.endsWith('.parquet'))
|
||||
|
||||
files.forEach(file => {
|
||||
it(`should parse data from ${file}`, async () => {
|
||||
const asyncBuffer = fileToAsyncBuffer(`test/files/${file}`)
|
||||
await parquetRead({
|
||||
file: asyncBuffer,
|
||||
@ -18,6 +18,6 @@ describe('parquetRead', () => {
|
||||
expect(toJson(rows)).toEqual(expected)
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user