mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
More tests & exports from pg-protocol
This commit is contained in:
parent
ad3e6035f4
commit
b6e327ce62
@ -2,7 +2,13 @@ const assert = require('node:assert')
|
||||
const test = require('node:test')
|
||||
const { describe, it } = test
|
||||
|
||||
const paths = ['pg', 'pg/lib/index.js', 'pg/lib/connection-parameters.js']
|
||||
const paths = [
|
||||
'pg',
|
||||
'pg/lib/index.js',
|
||||
'pg/lib/connection-parameters.js',
|
||||
'pg-protocol/dist/messages.js',
|
||||
'pg-native/lib/build-result.js',
|
||||
]
|
||||
for (const path of paths) {
|
||||
describe(`importing ${path}`, () => {
|
||||
it('works with require', () => {
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"pg-cursor": "^2.14.1",
|
||||
"pg-native": "^3.4.0",
|
||||
"pg-pool": "^3.9.1",
|
||||
"pg-query-stream": "^4.9.1"
|
||||
"pg-query-stream": "^4.9.1",
|
||||
"pg-protocol": "^1.9.0"
|
||||
},
|
||||
"author": "Brian M. Carlson <brian.m.carlson@gmail.com>",
|
||||
"license": "MIT"
|
||||
|
||||
18
packages/pg-esm-test/pg-protocol.test.js
Normal file
18
packages/pg-esm-test/pg-protocol.test.js
Normal file
@ -0,0 +1,18 @@
|
||||
import protocol, { NoticeMessage, DatabaseError } from 'pg-protocol/dist/messages.js'
|
||||
import { describe, it } from 'node:test'
|
||||
import { strict as assert } from 'node:assert'
|
||||
|
||||
describe('pg-protocol', () => {
|
||||
it('should export database error', () => {
|
||||
assert.ok(DatabaseError)
|
||||
})
|
||||
it('should export protocol', () => {
|
||||
assert.ok(protocol)
|
||||
assert.ok(protocol.noData)
|
||||
assert.ok(protocol.parseComplete)
|
||||
assert.ok(protocol.NoticeMessage)
|
||||
})
|
||||
it('should export NoticeMessage from file in dist folder', () => {
|
||||
assert.ok(NoticeMessage)
|
||||
})
|
||||
})
|
||||
@ -49,6 +49,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib",
|
||||
"esm"
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// ESM wrapper for pg-protocol
|
||||
import protocol from '../dist/index.js'
|
||||
import * as protocol from '../dist/index.js'
|
||||
|
||||
// Re-export all the properties
|
||||
export const DatabaseError = protocol.DatabaseError
|
||||
|
||||
@ -9,6 +9,11 @@
|
||||
"import": "./esm/index.js",
|
||||
"require": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"./dist/*": {
|
||||
"import": "./dist/*",
|
||||
"require": "./dist/*",
|
||||
"default": "./dist/*"
|
||||
}
|
||||
},
|
||||
"license": "MIT",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user