fix topic update integration test, topicGetByUrl now optionally applies defaults
[websub-hub] / src / db / sqlite / index.js
index 56afa000cb886f900277e4bf819139b93e926707..76309d6c039f623749b575b2f1b1b20f9fb212e5 100644 (file)
@@ -759,7 +759,7 @@ class DatabaseSQLite extends Database {
   }
 
 
-  topicGetByUrl(dbCtx, topicUrl) {
+  topicGetByUrl(dbCtx, topicUrl, applyDefaults = true) {
     const _scope = _fileScope('topicGetByUrl');
     this.logger.debug(_scope, 'called', { topicUrl });
 
@@ -767,7 +767,10 @@ class DatabaseSQLite extends Database {
     try {
       topic = this.statement.topicGetByUrl.get({ topicUrl });
       DatabaseSQLite._topicDataToNative(topic);
-      return this._topicDefaults(topic);
+      if (applyDefaults) {
+        topic = this._topicDefaults(topic);
+      }
+      return topic;
     } catch (e) {
       this.logger.error(_scope, 'failed', { error: e, topic, topicUrl });
       throw e;