浏览代码

restructuring test file

Enzo 1 年之前
父节点
当前提交
c4e86d7852
共有 8 个文件被更改,包括 92 次插入13 次删除
  1. 1 1
      dependencies/fisloggingservice
  2. 5 2
      package.json
  3. 4 4
      services/acknowledgement.service.ts
  4. 4 4
      services/incomingMessage.service.ts
  5. 37 0
      test/test1a.ts
  6. 1 1
      test/test1b.ts
  7. 40 0
      test/test2a.ts
  8. 0 1
      test/test2b.ts

+ 1 - 1
dependencies/fisloggingservice

@@ -1 +1 @@
-Subproject commit 89de1b23819874fb4485632bbe8c331883e6fc8f
+Subproject commit a148de57e81e42fbe60f22f79dccb2ddc51d173b

+ 5 - 2
package.json

@@ -5,8 +5,11 @@
   "main": "index.js",
   "scripts": {
     "build": "tsc -p tsconfig.json",
-    "start": "node test/test.js",
-    "start2": "node test/test2.js",
+    "start": "node test/test1a.js",
+    "start1a": "node test/test1a.js",
+    "start1b": "node test/test1b.js",
+    "start2a": "node test/test2a.js",
+    "start2b": "node test/test2b.js",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "repository": {

+ 4 - 4
services/acknowledgement.service.ts

@@ -13,13 +13,13 @@ export class AcknowledgementService implements Acknowledgemeent {
     private settings: LogSetting = {
         storage: '',
         setting: {
-            appId: undefined,
+            appId: '',
             appName: '',
             logLocName: '',
-            logLocId: undefined,
-            appLogLocId: undefined,
+            logLocId: '',
+            appLogLocId: '',
             appLocName: '',
-            appLogId: undefined
+            appLogId: ''
         }
     }
 

+ 4 - 4
services/incomingMessage.service.ts

@@ -14,13 +14,13 @@ export class IncomingMessageService implements IncomingMessageServiceInterface {
     private settings: LogSetting & { incomingObservable: Observable<BaseMessage>; } = {
         storage: '',
         setting: {
-            appId: undefined,
+            appId: '',
             appName: '',
             logLocName: '',
-            logLocId: undefined,
-            appLogLocId: undefined,
+            logLocId: '',
+            appLogLocId: '',
             appLocName: '',
-            appLogId: undefined
+            appLogId: ''
         },
         incomingObservable: null
     }

+ 37 - 0
test/test1a.ts

@@ -0,0 +1,37 @@
+import { AcknowledgementService } from "../services/acknowledgement.service";
+import { StreamingService } from "./test-streamOBS";
+import { MessageSyncrhonizationService } from "../services/synchronization.service";
+import { IncomingMessageService } from "../services/incomingMessage.service";
+import { map, Observable } from "rxjs";
+import { LogSetting, MessageLog } from "../dependencies/fisloggingservice/type/datatype";
+import { BaseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies";
+const incoming = new IncomingMessageService()
+const acknowledge = new AcknowledgementService()
+const syncrhonize = new MessageSyncrhonizationService()
+const streamService = new StreamingService()
+
+/* --------------  TEST -------------------- */
+// change payload into Observable<BaseMessage>
+const payload: Observable<BaseMessage> = streamService.stream();
+
+// Configure Log Setting
+let storage: LogSetting = {
+    storage: "File",
+    setting: {
+        appName: 'Default from client',
+        appLocName: 'To be generated in client',
+        logLocName: 'To be generated in client',
+    }
+}
+let dataSet: LogSetting & { incomingObservable: Observable<BaseMessage> } = {
+    storage: storage.storage,
+    setting: storage.setting,
+    customSetting: storage.customSetting,
+    incomingObservable: payload
+}
+
+incoming.init(dataSet)
+
+// acknowledge.init(storage).then(() => {
+//     acknowledge.subscribe(dataSet.incomingObservable)
+// })

+ 1 - 1
test/test.ts → test/test1b.ts

@@ -30,7 +30,7 @@ let dataSet: LogSetting & { incomingObservable: Observable<BaseMessage> } = {
     incomingObservable: payload
 }
 
-incoming.init(dataSet)
+// incoming.init(dataSet)
 
 acknowledge.init(storage).then(() => {
     acknowledge.subscribe(dataSet.incomingObservable)

+ 40 - 0
test/test2a.ts

@@ -0,0 +1,40 @@
+import { AcknowledgementService } from "../services/acknowledgement.service";
+import { StreamingService } from "./test-streamOBS";
+import { MessageSyncrhonizationService } from "../services/synchronization.service";
+import { IncomingMessageService } from "../services/incomingMessage.service";
+import { map, Observable, take } from "rxjs";
+import { LogSetting, MessageLog } from "../dependencies/fisloggingservice/type/datatype";
+import { BaseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies";
+const incoming = new IncomingMessageService()
+const syncrhonize = new MessageSyncrhonizationService()
+const acknowledge = new AcknowledgementService()
+const streamService = new StreamingService()
+
+/* --------------  TEST -------------------- */
+// change payload into Observable<BaseMessage>
+const payload: Observable<BaseMessage> = streamService.stream().pipe(take(3));
+
+// Configure Log Setting
+let storage: LogSetting = {
+    storage: "MongoDB",
+    setting: {
+        appName: 'Default from client',
+        appLocName: 'To be generated in client',
+        logLocName: 'To be generated in client',
+    },
+    customSetting: {
+        srv: true,
+        user: "testDB",
+        password: "h1nt1OyXw6QeUnzS",
+        server: "cluster0.29sklte.mongodb.net",
+        collection: "log",
+      }
+}
+let dataSet: LogSetting & { incomingObservable: Observable<BaseMessage> } = {
+    storage: storage.storage,
+    setting: storage.setting,
+    customSetting: storage.customSetting,
+    incomingObservable: payload
+}
+
+incoming.init(dataSet)

+ 0 - 1
test/test2.ts → test/test2b.ts

@@ -37,7 +37,6 @@ let dataSet: LogSetting & { incomingObservable: Observable<BaseMessage> } = {
     incomingObservable: payload
 }
 
-// incoming.init(dataSet)
 acknowledge.init(storage).then(() => {
     acknowledge.subscribe(dataSet.incomingObservable)
 })