-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
152 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package tests | ||
|
||
import ( | ||
"errors" | ||
"time" | ||
|
||
aw "github.com/deanishe/awgo" | ||
) | ||
|
||
// ensure MockAlfredUpdater implements Updater | ||
var _ aw.Updater = (*MockAlfredUpdater)(nil) | ||
|
||
type MockAlfredUpdater struct { | ||
updateIntervalCalled bool | ||
checkDueCalled bool | ||
checkForUpdateCalled bool | ||
updateAvailableCalled bool | ||
installCalled bool | ||
|
||
checkShouldFail bool | ||
installShouldFail bool | ||
} | ||
|
||
// UpdateInterval implements Updater. | ||
func (d *MockAlfredUpdater) UpdateInterval(_ time.Duration) { | ||
d.updateIntervalCalled = true | ||
} | ||
|
||
// UpdateAvailable implements Updater. | ||
func (d *MockAlfredUpdater) UpdateAvailable() bool { | ||
d.updateAvailableCalled = true | ||
return true | ||
} | ||
|
||
// CheckDue implements Updater. | ||
func (d *MockAlfredUpdater) CheckDue() bool { | ||
d.checkDueCalled = true | ||
return true | ||
} | ||
|
||
// CheckForUpdate implements Updater. | ||
func (d *MockAlfredUpdater) CheckForUpdate() error { | ||
d.checkForUpdateCalled = true | ||
if d.checkShouldFail { | ||
return errors.New("check failed") | ||
} | ||
return nil | ||
} | ||
|
||
// Install implements Updater. | ||
func (d *MockAlfredUpdater) Install() error { | ||
d.installCalled = true | ||
if d.installShouldFail { | ||
return errors.New("install failed") | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters