@@ -19,14 +19,16 @@ describe('buildUserAgentString', () => {
1919 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
2020 //
2121 // UserAgent ::= <ProductName> '/' <ProductVersion> '(' <Comment> ')'
22+ // where:
2223 // ProductName ::= 'NodejsDatabricksSqlConnector'
23- // <Comment> ::= [ <userAgentHeader> ';' ] 'Node.js' <NodeJsVersion> ';' <OSPlatform> <OSVersion>
24+ // ProductVersion ::= three period-separated digits
25+ // <Comment> ::= [ <userAgentEntry> ';' ] 'Node.js' <NodeJsVersion> ';' <OSPlatform> <OSVersion>
2426 //
2527 // Examples:
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)
28+ // - with <userAgentEntry > provided: NodejsDatabricksSqlConnector/0.1.8-beta.1 (<userAgentEntry> ; Node.js 16.13.1; Darwin 21.5.0)
29+ // - without <userAgentEntry > provided: NodejsDatabricksSqlConnector/0.1.8-beta.1 (Node.js 16.13.1; Darwin 21.5.0)
2830
29- function checkUserAgentString ( ua : string , userAgentHeader ?: string ) {
31+ function checkUserAgentString ( ua : string , userAgentEntry ?: string ) {
3032 // Prefix: 'NodejsDatabricksSqlConnector/'
3133 // Version: three period-separated digits and optional suffix
3234 const re =
@@ -39,18 +41,18 @@ describe('buildUserAgentString', () => {
3941 const parts = comment . split ( ';' ) . map ( ( s ) => s . trim ( ) ) ;
4042 expect ( parts . length ) . to . be . gte ( 2 ) ; // at least Node and OS version should be there
4143
42- if ( userAgentHeader ) {
43- expect ( comment . trim ( ) ) . to . satisfy ( ( s : string ) => s . startsWith ( `${ userAgentHeader } ;` ) ) ;
44+ if ( userAgentEntry ) {
45+ expect ( comment . trim ( ) ) . to . satisfy ( ( s : string ) => s . startsWith ( `${ userAgentEntry } ;` ) ) ;
4446 }
4547 }
4648
47- it ( 'matches pattern with userAgentHeader ' , ( ) => {
48- const userAgentHeader = 'Some Client ID ' ;
49- const ua = buildUserAgentString ( userAgentHeader ) ;
50- checkUserAgentString ( ua , userAgentHeader ) ;
49+ it ( 'matches pattern with userAgentEntry ' , ( ) => {
50+ const userAgentEntry = 'Some user agent ' ;
51+ const ua = buildUserAgentString ( userAgentEntry ) ;
52+ checkUserAgentString ( ua , userAgentEntry ) ;
5153 } ) ;
5254
53- it ( 'matches pattern without userAgentHeader ' , ( ) => {
55+ it ( 'matches pattern without userAgentEntry ' , ( ) => {
5456 const ua = buildUserAgentString ( ) ;
5557 checkUserAgentString ( ua ) ;
5658 } ) ;
0 commit comments