File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ struct OpenTask : public Task {
3333 : Task(database_, callback_), filename(filename_) {
3434
3535 duckdb_config.options .access_mode = access_mode_;
36+ duckdb_config.SetOptionByName (" duckdb_api" , duckdb::Value (" nodejs" ));
3637 Napi::Env env = database_.Env ();
3738 Napi::HandleScope scope (env);
3839
Original file line number Diff line number Diff line change 1+ import * as duckdb from '..' ;
2+ import * as assert from 'assert' ;
3+ import { TableData } from ".." ;
4+
5+ describe ( 'user_agent' , ( ) => {
6+
7+ it ( 'default value' , ( done ) => {
8+ const db : duckdb . Database = new duckdb . Database ( ':memory:' ) ;
9+
10+ db . all ( 'PRAGMA USER_AGENT' , ( err : null | Error , rows : TableData ) => {
11+ if ( err ) {
12+ throw err ;
13+ }
14+ assert . match ( rows [ 0 ] . user_agent , / d u c k d b \/ .* \( * \) n o d e j s / ) ;
15+ done ( ) ;
16+ } ) ;
17+ } )
18+
19+ it ( 'with custom_user_agent' , ( done ) => {
20+ const db : duckdb . Database = new duckdb . Database ( ':memory:' , { 'custom_user_agent' : 'a_framework' } ) ;
21+
22+ db . all ( 'PRAGMA USER_AGENT' , ( err : null | Error , rows : TableData ) => {
23+ if ( err ) {
24+ throw err ;
25+ }
26+ assert . match ( rows [ 0 ] . user_agent , / d u c k d b \/ .* \( * \) n o d e j s a _ f r a m e w o r k / ) ;
27+ done ( ) ;
28+ } ) ;
29+ } )
30+ } )
You can’t perform that action at this time.
0 commit comments