Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbrugger committed Apr 30, 2024
1 parent 7125a02 commit 08dc92e
Show file tree
Hide file tree
Showing 61 changed files with 6,451 additions and 15,822 deletions.
21,800 changes: 6,192 additions & 15,608 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,13 @@
"@flatfile/utils-testing": "^0.1.3",
"@parcel/packager-ts": "^2.12.0",
"@parcel/transformer-typescript-types": "^2.12.0",
"@types/jest": "^29.5.0",
"@types/bun": "^1.0.12",
"@types/node": "^20.2.5",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
"dotenv-flow": "^3.2.0",
"jest": "^29.5.0",
"parcel": "latest",
"prettier": "^3.2.5",
"ts-jest": "^29.1.0",
"turbo": "^1.10.2",
"typescript": "^5.0.4"
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/autocast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"build:watch": "rollup -c --watch",
"build:prod": "NODE_ENV=production rollup -c",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [
"flatfile-plugins",
Expand Down
1 change: 1 addition & 0 deletions plugins/autocast/src/autocast.plugin.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'bun:test'
import {
FALSY_VALUES,
TRUTHY_VALUES,
Expand Down
2 changes: 1 addition & 1 deletion plugins/automap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build:watch": "parcel watch",
"build:prod": "NODE_ENV=production parcel build",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [
"flatfile-plugins",
Expand Down
15 changes: 12 additions & 3 deletions plugins/automap/src/automap.plugin.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ import {
setupSimpleWorkbook,
setupSpace,
} from '@flatfile/utils-testing'
import {
afterAll,
beforeAll,
beforeEach,
describe,
expect,
it,
mock,
} from 'bun:test'
import fs from 'fs'
import path from 'path'
import { automap } from './automap.plugin'

const api = new FlatfileClient()

describe('automap() e2e', () => {
describe.skip('automap() e2e', () => {
const listener = setupListener()

let spaceId: string
Expand All @@ -27,7 +36,7 @@ describe('automap() e2e', () => {
})

describe('record created - static sheet slug', () => {
const mockFn = jest.fn()
const mockFn = mock()

beforeEach(async () => {
const stream = fs.createReadStream(path.join(__dirname, '../test.csv'))
Expand Down Expand Up @@ -66,7 +75,7 @@ describe('automap() e2e', () => {
})

describe('record created - dynamic sheet slug', () => {
const mockFn = jest.fn()
const mockFn = mock()

beforeEach(async () => {
const stream = fs.createReadStream(path.join(__dirname, '../test.csv'))
Expand Down
2 changes: 1 addition & 1 deletion plugins/constraints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"build:watch": "rollup -c --watch",
"build:prod": "NODE_ENV=production rollup -c",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [],
"author": "David Boskovic",
Expand Down
51 changes: 26 additions & 25 deletions plugins/constraints/src/external.constraint.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,34 @@ import {
setupSimpleWorkbook,
setupSpace,
} from '@flatfile/utils-testing'
import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'bun:test'
import { externalConstraint } from './external.constraint'

export const defaultSimpleValueSchema: Array<Flatfile.Property> = [
{
key: 'name',
type: 'string',
constraints: [
{ type: 'external', validator: 'test', config: { flag: true } },
],
},
{
key: 'age',
type: 'number',
},
]

export const defaultSimpleValueData = [
{
name: 'John Doe',
age: 1,
},
{
name: 'Jane Doe',
age: 1,
},
]

describe('externalConstraint()', () => {
const listener = setupListener()

Expand Down Expand Up @@ -71,28 +97,3 @@ describe('externalConstraint()', () => {
expect(records[0].values['name'].value).toEqual('JOHN DOE')
})
})

export const defaultSimpleValueSchema: Array<Flatfile.Property> = [
{
key: 'name',
type: 'string',
constraints: [
{ type: 'external', validator: 'test', config: { flag: true } },
],
},
{
key: 'age',
type: 'number',
},
]

export const defaultSimpleValueData = [
{
name: 'John Doe',
age: 1,
},
{
name: 'Jane Doe',
age: 1,
},
]
57 changes: 29 additions & 28 deletions plugins/constraints/src/external.sheet.constraint.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,37 @@ import {
setupSimpleWorkbook,
setupSpace,
} from '@flatfile/utils-testing'
import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'bun:test'
import { externalSheetConstraint } from './external.sheet.constraint'

export const defaultSimpleValueSchema: Array<Flatfile.Property> = [
{
key: 'name',
type: 'string',
},
{
key: 'age',
type: 'number',
},
{
key: 'email',
type: 'string',
},
]

export const defaultSimpleValueData = [
{
name: 'John Doe',
age: 1,
email: null,
},
{
name: null,
age: 1,
email: 'jane.doe@gmail.com',
},
]

describe('externalConstraint()', () => {
const listener = setupListener()

Expand Down Expand Up @@ -58,31 +87,3 @@ describe('externalConstraint()', () => {
})
})
})

export const defaultSimpleValueSchema: Array<Flatfile.Property> = [
{
key: 'name',
type: 'string',
},
{
key: 'age',
type: 'number',
},
{
key: 'email',
type: 'string',
},
]

export const defaultSimpleValueData = [
{
name: 'John Doe',
age: 1,
email: null,
},
{
name: null,
age: 1,
email: 'jane.doe@gmail.com',
},
]
2 changes: 1 addition & 1 deletion plugins/dedupe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"build:watch": "rollup -c --watch",
"build:prod": "NODE_ENV=production rollup -c",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [
"flatfile-plugins",
Expand Down
1 change: 1 addition & 0 deletions plugins/dedupe/src/keep.first.logic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'bun:test'
import { records } from './fake.data'
import { keepFirst } from './keep.first.logic'

Expand Down
1 change: 1 addition & 0 deletions plugins/dedupe/src/keep.last.logic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'bun:test'
import { records } from './fake.data'
import { keepLast } from './keep.last.logic'

Expand Down
2 changes: 1 addition & 1 deletion plugins/delimiter-extractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build:watch": "parcel watch",
"build:prod": "NODE_ENV=production parcel build",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [
"flatfile-plugins",
Expand Down
3 changes: 2 additions & 1 deletion plugins/delimiter-extractor/src/parser.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, spyOn, test } from 'bun:test'
import * as fs from 'fs'
import * as path from 'path'
import { parseBuffer } from './parser'
Expand Down Expand Up @@ -130,7 +131,7 @@ describe('parser', () => {
})
test('empty buffer', async () => {
const emptyBuffer = Buffer.from('', 'utf8')
const logSpy = jest.spyOn(global.console, 'log')
const logSpy = spyOn(global.console, 'log')
const parsedBuffer = await parseBuffer(emptyBuffer, { delimiter: '#' })
expect(logSpy).toHaveBeenCalledWith('No data found in the file')
expect(parsedBuffer).toEqual({})
Expand Down
2 changes: 1 addition & 1 deletion plugins/dxp-configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"build:watch": "rollup -c --watch",
"build:prod": "NODE_ENV=production rollup -c",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [
"flatfile-plugins",
Expand Down
3 changes: 2 additions & 1 deletion plugins/dxp-configure/src/shim.target.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { shimTarget } from './shim.target' // replace 'your-file' with actual filename
import { describe, expect, it } from 'bun:test'
import { shimTarget } from './shim.target'

describe('shimTarget()', () => {
it('returns "space(*)" for a file domain', () => {
Expand Down
2 changes: 1 addition & 1 deletion plugins/export-workbook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build:watch": "parcel watch",
"build:prod": "NODE_ENV=production parcel build",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest --passWithNoTests"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [
"flatfile-plugins",
Expand Down
2 changes: 1 addition & 1 deletion plugins/foreign-db-extractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"build:watch": "rollup -c --watch",
"build:prod": "NODE_ENV=production rollup -c",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest --passWithNoTests"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [],
"author": "Flatfile, Inc.",
Expand Down
2 changes: 1 addition & 1 deletion plugins/graphql-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"build:watch": "rollup -c --watch",
"build:prod": "NODE_ENV=production rollup -c",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [],
"author": "Flatfile, Inc.",
Expand Down
2 changes: 1 addition & 1 deletion plugins/job-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"build:watch": "rollup -c --watch",
"build:prod": "NODE_ENV=production rollup -c",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [
"flatfile-plugins",
Expand Down
15 changes: 12 additions & 3 deletions plugins/job-handler/src/job.handler.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { deleteSpace, setupListener, setupSpace } from '@flatfile/utils-testing'
import {
afterAll,
beforeAll,
describe,
expect,
mock,
spyOn,
test,
} from 'bun:test'
import { jobHandler } from '.'

describe('JobHandler plugin e2e tests', () => {
describe('jobHandler() successful', () => {
const listener = setupListener()
const mockFn = jest.fn()
const mockFn = mock()
let spaceId: string

beforeAll(async () => {
Expand All @@ -26,9 +35,9 @@ describe('JobHandler plugin e2e tests', () => {
})

describe('jobHandler() failure', () => {
const logErrorSpy = jest.spyOn(global.console, 'error')
const logErrorSpy = spyOn(global.console, 'error')
const listener = setupListener()
const mockErrorFn = jest.fn(() => {
const mockErrorFn = mock(() => {
throw new Error('trigger job:failed')
})
let spaceId: string
Expand Down
2 changes: 1 addition & 1 deletion plugins/json-extractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"build:watch": "rollup -c --watch",
"build:prod": "NODE_ENV=production rollup -c",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [
"flatfile-plugins",
Expand Down
1 change: 1 addition & 0 deletions plugins/json-extractor/src/parser.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, test } from 'bun:test'
import * as fs from 'fs'
import * as path from 'path'
import { parseBuffer } from './parser'
Expand Down
2 changes: 1 addition & 1 deletion plugins/json-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build:watch": "parcel watch",
"build:prod": "NODE_ENV=production parcel build",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [
"flatfile-plugins",
Expand Down
1 change: 1 addition & 0 deletions plugins/json-schema/src/setup.factory.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from 'bun:test'
import { generateSetup } from './setup.factory'

describe('generateSetup()', () => {
Expand Down
2 changes: 1 addition & 1 deletion plugins/merge-connection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"build:watch": "parcel watch",
"build:prod": "NODE_ENV=production parcel build",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest --passWithNoTests"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [],
"author": "Carl Brugger",
Expand Down
2 changes: 1 addition & 1 deletion plugins/openapi-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"build:watch": "rollup -c --watch",
"build:prod": "NODE_ENV=production rollup -c",
"check": "tsc ./**/*.ts --noEmit --esModuleInterop",
"test": "jest ./**/*.spec.ts --config=../../jest.config.js --runInBand"
"test": "bun --env-file=../../.env.defaults test"
},
"keywords": [
"flatfile-plugins",
Expand Down
Loading

0 comments on commit 08dc92e

Please sign in to comment.