-
Notifications
You must be signed in to change notification settings - Fork 53
MLE-25617 Two more client-level TS methods #1041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Copyright Validation Results ✅ Valid Files
✅ All files have valid copyright headers! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds TypeScript support for two client-level methods: setLogger and setAuthToken. It includes both compile-time type checking tests and runtime validation tests to ensure the methods work correctly in TypeScript environments.
Key Changes
- Added compile-time type checking tests for
setLogger(with logger object and level string) andsetAuthToken - Added runtime validation tests for
setLoggerwith both logger object and level string configurations
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| test-typescript/dbclient-setLogger-setAuthToken-compile.test.ts | New file containing compile-time type checking tests for setLogger and setAuthToken methods |
| test-typescript/dbclient-convenience-runtime.test.ts | Added runtime validation tests for setLogger with level string and logger object |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| import type { DatabaseClient } from 'marklogic'; | ||
|
|
||
| const marklogic = require('../lib/marklogic.js'); |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixing import type with require is inconsistent. Consider using import for the module on line 10 instead of require, or remove the type-only import and use type assertions instead. This ensures consistency in import style throughout the file.
| const marklogic = require('../lib/marklogic.js'); | |
| import * as marklogic from '../lib/marklogic.js'; |
| }); | ||
|
|
||
|
|
||
|
|
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Remove excessive blank lines. There should be at most one blank line between test cases for consistency with the rest of the file.
| it('should use setLogger with a level string', async function() { | ||
| // Set logger to 'info' level | ||
| client.setLogger('info'); | ||
|
|
||
| // Verify client is still functional after setting logger | ||
| const result = await client.probe(testUri).result(); | ||
| result.should.have.property('exists'); | ||
| result.should.have.property('uri'); | ||
| }); |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test verifies that the client remains functional after calling setLogger, but doesn't validate that the logger is actually being used or that log messages are being produced. Consider capturing log output or verifying logger behavior to ensure setLogger actually configures logging correctly.
| it('should use setLogger with a logger object', async function() { | ||
| // Create a simple logger object | ||
| const testLogger = { | ||
| debug: (msg: string) => console.log('DEBUG:', msg), | ||
| info: (msg: string) => console.log('INFO:', msg), | ||
| warn: (msg: string) => console.log('WARN:', msg), | ||
| error: (msg: string) => console.log('ERROR:', msg) | ||
| }; | ||
|
|
||
| // Set logger with object | ||
| client.setLogger(testLogger, false); | ||
|
|
||
| // Verify client is still functional after setting logger | ||
| const result = await client.probe(testUri).result(); | ||
| result.should.have.property('exists'); | ||
| result.should.have.property('uri'); | ||
| }); |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test verifies that the client remains functional after calling setLogger with a custom logger object, but doesn't validate that the custom logger is actually being invoked. Consider tracking whether the logger methods are called to ensure setLogger properly integrates the custom logger.
f9dfe16 to
3e40374
Compare
3e40374 to
a5442e3
Compare
No description provided.