@@ -20,13 +20,13 @@ describe('buildUserAgentString', () => {
2020 //
2121 // UserAgent ::= <ProductName> '/' <ProductVersion> '(' <Comment> ')'
2222 // ProductName ::= 'NodejsDatabricksSqlConnector'
23- // <Comment> ::= [ <ClientId > ';' ] 'Node.js' <NodeJsVersion> ';' <OSPlatform> <OSVersion>
23+ // <Comment> ::= [ <userAgentHeader > ';' ] 'Node.js' <NodeJsVersion> ';' <OSPlatform> <OSVersion>
2424 //
2525 // Examples:
26- // - with <ClientId > provided: NodejsDatabricksSqlConnector/0.1.8-beta.1 (Client ID; Node.js 16.13.1; Darwin 21.5.0)
27- // - without <ClientId > provided: NodejsDatabricksSqlConnector/0.1.8-beta.1 (Node.js 16.13.1; Darwin 21.5.0)
26+ // - with <userAgentHeader > provided: NodejsDatabricksSqlConnector/0.1.8-beta.1 (Client ID; Node.js 16.13.1; Darwin 21.5.0)
27+ // - without <userAgentHeader > provided: NodejsDatabricksSqlConnector/0.1.8-beta.1 (Node.js 16.13.1; Darwin 21.5.0)
2828
29- function checkUserAgentString ( ua : string , clientId ?: string ) {
29+ function checkUserAgentString ( ua : string , userAgentHeader ?: string ) {
3030 // Prefix: 'NodejsDatabricksSqlConnector/'
3131 // Version: three period-separated digits and optional suffix
3232 const re =
@@ -38,18 +38,18 @@ describe('buildUserAgentString', () => {
3838
3939 expect ( comment . split ( ';' ) . length ) . to . be . gte ( 2 ) ; // at least Node and OS version should be there
4040
41- if ( clientId ) {
42- expect ( comment . trim ( ) ) . to . satisfy ( ( s : string ) => s . startsWith ( `${ clientId } ;` ) ) ;
41+ if ( userAgentHeader ) {
42+ expect ( comment . trim ( ) ) . to . satisfy ( ( s : string ) => s . startsWith ( `${ userAgentHeader } ;` ) ) ;
4343 }
4444 }
4545
46- it ( 'matches pattern with clientId ' , ( ) => {
47- const clientId = 'Some Client ID' ;
48- const ua = buildUserAgentString ( clientId ) ;
49- checkUserAgentString ( ua , clientId ) ;
46+ it ( 'matches pattern with userAgentHeader ' , ( ) => {
47+ const userAgentHeader = 'Some Client ID' ;
48+ const ua = buildUserAgentString ( userAgentHeader ) ;
49+ checkUserAgentString ( ua , userAgentHeader ) ;
5050 } ) ;
5151
52- it ( 'matches pattern without clientId ' , ( ) => {
52+ it ( 'matches pattern without userAgentHeader ' , ( ) => {
5353 const ua = buildUserAgentString ( ) ;
5454 checkUserAgentString ( ua ) ;
5555 } ) ;
0 commit comments