-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathTestExamples.ts
More file actions
29 lines (23 loc) · 834 Bytes
/
TestExamples.ts
File metadata and controls
29 lines (23 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import MessageStore from './MessageStore';
import CustomMessageStore from './CustomMessageStore';
import fs from 'fs';
import path from 'path'
var dirtest = "./testfiles";
var dirpath = path.join(__dirname, dirtest)
if(!fs.existsSync(dirpath)){
fs.mkdirSync(dirpath)
}
(async () => {
// Test the CustomMessageStore class
console.log("** Test the CustomMessageStore class **")
console.log()
var messagestore = new CustomMessageStore(dirtest);
// Note: Simply comment out the above line and uncomment the
// line below and we are back to our orginal MessageStore
// that does not log to Splunk!
// var messagestore = new MessageStore(dirtest);
await messagestore.save(99, 'Message 99 saved via MessageStore class')
var fileMessage99 = messagestore.read(99)
console.log(fileMessage99)
console.log()
})();