Skip to content

Commit 0d26183

Browse files
committed
fix: remove object case
1 parent 8dae68d commit 0d26183

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/cmap/handshake/client_metadata.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ declare const Deno: { version?: { deno?: string } } | undefined;
249249
* expect it to satisfy. In order to not ship code in the driver that would break
250250
* future versions of this runtime assume all properties are nullish.
251251
*/
252-
declare const Bun: { version?: string } | undefined;
252+
declare const Bun: { (): void; version?: string } | undefined;
253253

254254
/**
255255
* @internal
@@ -278,7 +278,7 @@ function getRuntimeInfo(): string {
278278
if ('Bun' in globalThis) {
279279
const version =
280280
Bun != null &&
281-
(typeof Bun === 'function' || typeof Bun === 'object') &&
281+
typeof Bun === 'function' &&
282282
'version' in Bun &&
283283
typeof Bun.version === 'string'
284284
? Bun.version

test/unit/cmap/handshake/client_metadata.test.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -344,18 +344,10 @@ describe('client metadata module', () => {
344344
expect(delete globalThis.Bun, 'failed to delete Bun global').to.be.true;
345345
});
346346

347-
it('sets platform to Bun if typeof is object', () => {
348-
globalThis.Bun = { version: '1.2.3' };
349-
const metadata = makeClientMetadata({ driverInfo: {} });
350-
expect(metadata.platform).to.equal('Bun v1.2.3, LE');
351-
});
352-
353-
it('sets platform to Bun if typeof is function', () => {
354-
function Bun() {
355-
return null;
356-
}
357-
Bun.version = '1.2.3';
358-
globalThis.Bun = Bun;
347+
it('sets platform to Bun', () => {
348+
globalThis.Bun = class {
349+
static version = '1.2.3';
350+
};
359351
const metadata = makeClientMetadata({ driverInfo: {} });
360352
expect(metadata.platform).to.equal('Bun v1.2.3, LE');
361353
});

0 commit comments

Comments
 (0)