Begin moving files to proper extension and adding tests

This commit is contained in:
Brian Carlson 2025-04-21 13:22:01 -05:00
parent 6949c7ad73
commit 0cb8fd4216
11 changed files with 44 additions and 14 deletions

View File

@ -1,10 +0,0 @@
// test/my-module.test.js
import assert from 'node:assert'
import { describe, it } from 'node:test'
import { Client } from 'pg'
describe('executeQuery', () => {
it('should return a non-empty result for a valid query', async () => {
assert.ok(true, 'hi')
})
})

View File

@ -14,7 +14,9 @@
"test"
],
"dependencies": {
"pg": "^8.14.1"
"pg": "^8.14.1",
"pg-pool": "^3.8.0",
"pg-native": "^3.3.0"
},
"author": "Brian M. Carlson <brian.m.carlson@gmail.com>",
"license": "MIT"

View File

@ -0,0 +1,10 @@
// test/my-module.test.js
import assert from 'node:assert'
import { describe, it } from 'node:test'
import Client from 'pg-native'
describe('pg-native', () => {
it('should export Client constructor', () => {
assert.ok(new Client())
})
})

View File

@ -0,0 +1,10 @@
// test/my-module.test.js
import assert from 'node:assert'
import { describe, it } from 'node:test'
import Pool from 'pg-pool'
describe('pg-pool', () => {
it('should export Pool constructor', () => {
assert.ok(new Pool())
})
})

View File

@ -0,0 +1,18 @@
// test/my-module.test.js
import assert from 'node:assert'
import { describe, it } from 'node:test'
import pg, { Client, Pool } from 'pg'
describe('pg', () => {
it('should export Client constructor', () => {
assert.ok(new Client())
})
it('should export Pool constructor', () => {
assert.ok(new Pool())
})
it('should still provide default export', () => {
assert.ok(new pg.Pool())
})
})

View File

@ -5,7 +5,7 @@
"main": "index.js",
"exports": {
".": {
"import": "./esm/index.js",
"import": "./esm/index.mjs",
"require": "./index.js",
"default": "./index.js"
}

View File

@ -5,7 +5,7 @@
"main": "index.js",
"exports": {
".": {
"import": "./esm/index.js",
"import": "./esm/index.mjs",
"require": "./index.js",
"default": "./index.js"
}

View File

@ -21,7 +21,7 @@
"main": "./lib",
"exports": {
".": {
"import": "./esm/index.js",
"import": "./esm/index.mjs",
"require": "./lib/index.js",
"default": "./lib/index.js"
}