Skip to content

Commit

Permalink
Updated unit tests to use MustParseDate
Browse files Browse the repository at this point in the history
  • Loading branch information
twystd committed Jun 6, 2024
1 parent 443c60d commit 4fe35be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
29 changes: 14 additions & 15 deletions commands/get_cards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package commands
import (
"bytes"
"testing"
"time"

"github.com/uhppoted/uhppote-core/types"
)
Expand All @@ -18,20 +17,20 @@ func TestGetCardsPrint(t *testing.T) {
recordset := []types.Card{
types.Card{
CardNumber: 12345,
From: types.ToDate(2023, time.January, 1),
To: types.ToDate(2023, time.December, 21),
From: types.MustParseDate("2023-01-01"),
To: types.MustParseDate("2023-12-21"),
Doors: map[uint8]uint8{1: 1, 2: 0, 3: 0, 4: 0},
},
types.Card{
CardNumber: 8165539,
From: types.ToDate(2023, time.January, 1),
To: types.ToDate(2023, time.December, 31),
From: types.MustParseDate("2023-01-01"),
To: types.MustParseDate("2023-12-31"),
Doors: map[uint8]uint8{1: 1, 2: 0, 3: 0, 4: 29},
},
types.Card{
CardNumber: 8165538,
From: types.ToDate(2023, time.January, 1),
To: types.ToDate(2023, time.December, 31),
From: types.MustParseDate("2023-01-01"),
To: types.MustParseDate("2023-12-31"),
Doors: map[uint8]uint8{1: 1, 2: 0, 3: 0, 4: 29},
PIN: 7531,
},
Expand All @@ -57,27 +56,27 @@ func TestGetCardsPrintWithInvalidCardNumber(t *testing.T) {
recordset := []types.Card{
types.Card{
CardNumber: 12345,
From: types.ToDate(2023, time.January, 1),
To: types.ToDate(2023, time.December, 21),
From: types.MustParseDate("2023-01-01"),
To: types.MustParseDate("2023-12-21"),
Doors: map[uint8]uint8{1: 1, 2: 0, 3: 0, 4: 0},
},
types.Card{
CardNumber: 8165539,
From: types.ToDate(2023, time.January, 1),
To: types.ToDate(2023, time.December, 31),
From: types.MustParseDate("2023-01-01"),
To: types.MustParseDate("2023-12-31"),
Doors: map[uint8]uint8{1: 1, 2: 0, 3: 0, 4: 29},
},
types.Card{
CardNumber: 8165538,
From: types.ToDate(2023, time.January, 1),
To: types.ToDate(2023, time.December, 31),
From: types.MustParseDate("2023-01-01"),
To: types.MustParseDate("2023-12-31"),
Doors: map[uint8]uint8{1: 1, 2: 0, 3: 0, 4: 29},
PIN: 7531,
},
types.Card{
CardNumber: 192837465,
From: types.ToDate(2023, time.January, 1),
To: types.ToDate(2023, time.December, 31),
From: types.MustParseDate("2023-01-01"),
To: types.MustParseDate("2023-12-31"),
Doors: map[uint8]uint8{1: 1, 2: 0, 3: 0, 4: 29},
PIN: 7531,
},
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/uhppoted/uhppote-cli
go 1.22

require (
github.com/uhppoted/uhppote-core v0.8.9-0.20240605161320-cd6c0e95347b
github.com/uhppoted/uhppoted-lib v0.8.9-0.20240605161930-54dea6fc78b1
github.com/uhppoted/uhppote-core v0.8.9-0.20240606155158-a18316ae7528
github.com/uhppoted/uhppoted-lib v0.8.9-0.20240606160456-0430d2c98f6d
)

require golang.org/x/sys v0.21.0 // indirect
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/uhppoted/uhppote-core v0.8.9-0.20240605161320-cd6c0e95347b h1:8+6eR7uTFE5cD3tdbOjat2NoI/zS3Pj1eK4WXZvQweA=
github.com/uhppoted/uhppote-core v0.8.9-0.20240605161320-cd6c0e95347b/go.mod h1:Q+DHtT8s74efLs2b0eF20DRBUL9yBkySwaTQ+0lsEVM=
github.com/uhppoted/uhppoted-lib v0.8.9-0.20240605161930-54dea6fc78b1 h1:T1tGRfDa/jN9apkZtiid5FmHMMxjNXuazp7Mi9J4K/U=
github.com/uhppoted/uhppoted-lib v0.8.9-0.20240605161930-54dea6fc78b1/go.mod h1:di+eHPBWGIN6UwtmjXNPzmKZyoE8VL7f1KDbbw1cFzQ=
github.com/uhppoted/uhppote-core v0.8.9-0.20240606155158-a18316ae7528 h1:vNa68NNnTJITeZCfbreLiNT9OCbKQ3EUGByZ6PicEDc=
github.com/uhppoted/uhppote-core v0.8.9-0.20240606155158-a18316ae7528/go.mod h1:Q+DHtT8s74efLs2b0eF20DRBUL9yBkySwaTQ+0lsEVM=
github.com/uhppoted/uhppoted-lib v0.8.9-0.20240606160456-0430d2c98f6d h1:tc5XXgrJMMZT8kogXpBJkt4QMO/UYbOIyLVRtxzbp24=
github.com/uhppoted/uhppoted-lib v0.8.9-0.20240606160456-0430d2c98f6d/go.mod h1:9o0r7f2N16ZF4ryNQZOa84e9bByEkP/5YwCwLim0Q3s=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=

0 comments on commit 4fe35be

Please sign in to comment.