-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule_test.go
More file actions
89 lines (75 loc) · 1.86 KB
/
Copy pathmodule_test.go
File metadata and controls
89 lines (75 loc) · 1.86 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package module
import (
"fmt"
"os"
"testing"
"github.com/aiteung/atdb"
"github.com/aiteung/module/model"
)
var MongoInfo = atdb.DBInfo{
DBString: os.Getenv("MONGOSTRING"),
DBName: "iteung",
}
var MongoConn = atdb.MongoConnect(MongoInfo)
var Pesan = model.IteungMessage{
Phone_number: "6281312000300",
Chat_server: "g.us",
Group_name: "NN257S",
Group_id: "1234566954",
Message: "teung minta token group",
Group: "",
Alias_name: "Rolly Maulana Awangga",
Is_group: true,
}
var NewModule = model.Module{
Name: "pomodoro",
Keyword: []string{"pomodoro", "cek", "status"},
}
var ModuleCollection = "module"
var NewTypo = model.Typo{
From: "grub",
To: "grup",
}
var TypoCollection = "typo"
func TestInsertCollection(t *testing.T) {
//atdb.InsertOneDoc(MongoConn, ModuleCollection, NewModule)
//atdb.InsertOneDoc(MongoConn, TypoCollection, NewTypo)
}
func TestModuleCall(t *testing.T) {
var modulename string
if modulename != "" {
fmt.Println(modulename)
} else {
fmt.Println("inisiasi module empty string defaultnya")
}
NormalizeAndTypoCorrection(&Pesan.Message, MongoConn, TypoCollection)
if IsIteungCall(Pesan) {
modulename = GetModuleName(Pesan, MongoConn, ModuleCollection)
if modulename != "" {
fmt.Println(modulename)
} else {
fmt.Println("tidak ada module")
}
} else {
fmt.Println("Pesan tidak memanggil iteung")
}
if modulename != "" {
reply := Caller(modulename, Pesan)
fmt.Println(reply)
}
}
func TestAPI(t *testing.T) {
var msg = model.GowaNotif{
User: "6281312000300",
Server: "s.whatsapp.net",
Messages: "alo",
}
var ApiWa string = os.Getenv("URLAPIWA")
resp, err := SendToGoWAAPI(msg, ApiWa)
fmt.Println(resp, err)
}
func TestAPIBEV2(t *testing.T) {
var urlv2iteung string = os.Getenv("URLITEUNGBEV2")
resp, err := SendToIteungAPI(Pesan, urlv2iteung)
fmt.Println(resp, err)
}