Skip to content

Commit

Permalink
test substrings
Browse files Browse the repository at this point in the history
  • Loading branch information
ghedamat committed Jan 25, 2014
1 parent 44c32cd commit ebb8ed5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions test/on_off_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestOnOffWidget(t *testing.T) {
w.SetChannels(c, i)
w.Start()
Convey("When an entry is sent", func() {
w.Input <- i3status.Entry{}
w.Input <- i3status.Entry{Name: "OnOff"}
Convey("widget status goes on", func() {
So(w.On, ShouldEqual, true)
})
Expand All @@ -44,7 +44,7 @@ func TestOnOffWidgetMessage(t *testing.T) {
Convey("When and entry is sent", func() {
msg := <-c
So(msg.FullText, ShouldEqual, "Pants Off")
w.Input <- i3status.Entry{}
w.Input <- i3status.Entry{Name: "OnOff"}
Convey("widget message is On", func() {
msg = <-c
So(msg.FullText, ShouldEqual, "Pants On")
Expand Down
14 changes: 7 additions & 7 deletions test/timer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ func TestTimerWidgetStartEvent(t *testing.T) {
msg := <-c
i <- i3status.Entry{"Timer", "0", 1, 0, 0}
time.Sleep(1)
Convey("timer status is running", func() {
So(w.Status, ShouldEqual, "running")
Convey("timer status is started", func() {
So(w.Status, ShouldContainSubstring, "started")
msg = <-c
So(msg.FullText, ShouldEqual, "Timer running")
So(msg.FullText, ShouldContainSubstring, "started")
})
})
})
Expand All @@ -55,8 +55,8 @@ func TestTimerWidgetPauseEvent(t *testing.T) {
time.Sleep(1)
Convey("timer status is paused", func() {
msg = <-c
So(w.Status, ShouldEqual, "paused")
So(msg.FullText, ShouldEqual, "Timer paused")
So(w.Status, ShouldContainSubstring, "paused")
So(msg.FullText, ShouldContainSubstring, "paused")
})
})
})
Expand All @@ -76,8 +76,8 @@ func TestTimerWidgetStopEvent(t *testing.T) {
time.Sleep(1)
Convey("timer status is stopped", func() {
msg = <-c
So(w.Status, ShouldEqual, "stopped")
So(msg.FullText, ShouldEqual, "Timer stopped")
So(w.Status, ShouldContainSubstring, "stopped")
So(msg.FullText, ShouldContainSubstring, "stopped")
})
})
})
Expand Down

0 comments on commit ebb8ed5

Please sign in to comment.