This repository has been archived by the owner on Jan 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuoy_test.go
83 lines (71 loc) · 1.73 KB
/
buoy_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
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
package surfnerd
import (
"fmt"
"testing"
"time"
)
func TestLatestBuoyReadingFetch(t *testing.T) {
buoy := GetBuoyByID("44097")
if buoy == nil {
fmt.Println("Could not find the buoy for the given ID")
t.FailNow()
}
fetchError := buoy.FetchLatestBuoyReading()
if fetchError != nil {
fmt.Println("Failed to fetch the latest buoy data")
t.FailNow()
}
}
func TestStandardDataFetch(t *testing.T) {
buoy := GetBuoyByID("44017")
if buoy == nil {
fmt.Println("Could not find the buoy for the given ID")
t.FailNow()
}
fetchError := buoy.FetchStandardData(60)
if fetchError != nil {
fmt.Println("Failed to fetch the latest buoy data")
t.FailNow()
}
}
func TestDetailedWaveDataFetch(t *testing.T) {
buoy := GetBuoyByID("44017")
if buoy == nil {
fmt.Println("Could not find the buoy for the given ID")
t.FailNow()
}
fetchError := buoy.FetchDetailedWaveData(60)
if fetchError != nil {
fmt.Println("Failed to fetch the latest buoy data")
t.FailNow()
}
}
func TestRawSpectraDataFetch(t *testing.T) {
buoy := GetBuoyByID("44097")
if buoy == nil {
fmt.Println("Could not find the buoy for the given ID")
t.FailNow()
}
fetchError := buoy.FetchRawWaveSpectraData(1)
if fetchError != nil {
fmt.Println("Failed to fetch the raw spectra buoy data")
t.FailNow()
}
}
func TestClosestBuoyDataFinder(t *testing.T) {
buoy := GetBuoyByID("44017")
if buoy == nil {
fmt.Println("Could not find the buoy for the given ID")
t.FailNow()
}
fetchError := buoy.FetchDetailedWaveData(60)
if fetchError != nil {
fmt.Println("Failed to fetch the latest buoy data")
t.FailNow()
}
_, dur := buoy.FindConditionsForDateAndTime(time.Now())
if dur < 0 {
fmt.Println("Failed to find buoy data for the given date")
t.FailNow()
}
}