-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprivnote_test.go
54 lines (42 loc) · 1.6 KB
/
privnote_test.go
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
package privnote
import (
"math/rand"
"testing"
)
// https://coder-ipsum.tech/
var randomNotes = []string{
`Use the native DOM algorithm, then you can compile the idiosyncratic devops!`,
`So bubble-sorting the document object model won't do anything, we need to circle back the test-driven LIFO stream!`,
`You can't pair the resource without pair programming the containerized SOAP RSS feed!`,
`I'll promise the functional XML language, that should Internet Explorer the CLI controller!`,
`Try to ship the OOP emoji, maybe it will promise the dynamic graph!`,
`The CLI child is down, graph the scalable devops so we can uglify the FIFO Netscape!`,
`Try to rebase the CLI Imagemagick, maybe it will pivot the ecommerce code!`,
`The SRE presenter is down, pair the mobile hashtable so we can pivot the FP callback!`,
`We need to grep the atomic SQL data store!`,
`I'll circle back the senior XML RSS feed, that should Internet Explorer the AWS language!`,
}
func TestPrivnote(t *testing.T) {
t.Log("Testing go-privnote...")
noteData := randomNotes[rand.Intn(len(randomNotes))]
t.Logf("Using note data: \"%s\"", noteData)
client := NewClient()
// Creating a note
noteLink, err := client.CreateNote(CreateNoteData{
Data: noteData,
})
if err != nil {
t.Fatal("Failed to create note:", err)
}
t.Log("Created note:", noteLink)
// Reading the readNote
readNote, err := client.ReadNoteFromLink(noteLink)
if err != nil {
t.Fatal("Failed to read note:", err)
}
t.Logf("Read note: \"%s\"", readNote)
if readNote != noteData {
t.Fatal("Note data does not match!")
}
t.Log("Done testing go-privnote.")
}