Skip to content

Commit cea1925

Browse files
committed
sea-auth-u2m: refresh test fakes for the merged-kernel binding surface
Rebased onto the updated sea-operation (carrying the #379 review fixes up the stack). Test-fake refresh: - execution.test.ts: keep the sessionId getter; executeStatement(sql) only (the session-level options migration already on this branch dropped the per-statement options). - _helpers/fakeBinding.ts: cast Connection/Statement through the binding's member types instead of bare Function. - OAuth e2e tests (auth-m2m / auth-u2m): cast the connect literal as ConnectionOptions & InternalConnectionOptions for the useSEA opt-in. Known follow-ups (not test fakes; tracked separately): SeaBackend passes OAuth options (authMode/oauthClientId) that the merged-kernel binding's ConnectionOptions does not yet expose — the kernel's OAuth napi surface must land in main first; and the SeaOperationBackend neutral-type conformance (status/getResultMetadata) is the sea-results follow-up. Co-authored-by: Isaac
1 parent bed0d03 commit cea1925

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

tests/e2e/sea/auth-m2m-e2e.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { expect } from 'chai';
1616
import { DBSQLClient } from '../../../lib';
1717
import AuthenticationError from '../../../lib/errors/AuthenticationError';
1818
import { isBlankOrReserved } from '../../../lib/sea/SeaAuth';
19+
import { ConnectionOptions } from '../../../lib/contracts/IDBSQLClient';
20+
import { InternalConnectionOptions } from '../../../lib/contracts/InternalConnectionOptions';
1921

2022
/**
2123
* sea-auth M1 OAuth M2M end-to-end:
@@ -76,7 +78,7 @@ describe('sea-auth e2e — OAuth M2M through DBSQLClient ↔ SeaBackend ↔ napi
7678
oauthClientId: oauthClientId as string,
7779
oauthClientSecret: oauthClientSecret as string,
7880
useSEA: true,
79-
});
81+
} as ConnectionOptions & InternalConnectionOptions);
8082
expect(connected).to.equal(client);
8183

8284
const session = await client.openSession();
@@ -103,7 +105,7 @@ describe('sea-auth e2e — OAuth M2M through DBSQLClient ↔ SeaBackend ↔ napi
103105
oauthClientId: oauthClientId as string,
104106
oauthClientSecret: 'definitely-not-the-real-secret-deadbeef',
105107
useSEA: true,
106-
});
108+
} as ConnectionOptions & InternalConnectionOptions);
107109

108110
let caught: unknown;
109111
try {

tests/e2e/sea/auth-u2m-e2e.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
import { expect } from 'chai';
1616
import { DBSQLClient } from '../../../lib';
17+
import { ConnectionOptions } from '../../../lib/contracts/IDBSQLClient';
18+
import { InternalConnectionOptions } from '../../../lib/contracts/InternalConnectionOptions';
1719

1820
/**
1921
* sea-auth M1 OAuth U2M end-to-end — **SKIPPED pending browser harness**.
@@ -58,7 +60,7 @@ describe('sea-auth e2e — OAuth U2M through DBSQLClient ↔ SeaBackend ↔ napi
5860
path,
5961
authType: 'databricks-oauth',
6062
useSEA: true,
61-
});
63+
} as ConnectionOptions & InternalConnectionOptions);
6264
expect(connected).to.equal(client);
6365

6466
const session = await client.openSession();

tests/unit/sea/_helpers/fakeBinding.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ export function makeFakeBinding(): FakeBinding {
5252
calls.push({ method: 'openSession', args: [opts] });
5353
return fakeConnection as unknown as SeaNativeConnection;
5454
},
55-
Connection: function FakeConnection() {} as unknown as Function,
56-
Statement: function FakeStatement() {} as unknown as Function,
55+
// Index the binding type for the napi class constructor types; the
56+
// loader exports Connection/Statement as type aliases, so `typeof
57+
// Connection` is illegal and bare `Function` has no construct signature.
58+
Connection: function FakeConnection() {} as unknown as SeaNativeBinding['Connection'],
59+
Statement: function FakeStatement() {} as unknown as SeaNativeBinding['Statement'],
5760
};
5861

5962
return { binding, calls };

0 commit comments

Comments
 (0)