Skip to content

Commit

Permalink
add isprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
geerew committed Nov 22, 2024
1 parent 73932ef commit 52a84e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions utils/types/scan_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ func (ss ScanStatus) IsWaiting() bool {

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// IsProcessing returns true is the status is process
func (ss ScanStatus) IsProcessing() bool {
return ss.s == ScanStatusProcessing
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// String implements the `Stringer` interface
func (ss ScanStatus) String() string {
return fmt.Sprint(ss.s)
Expand Down
9 changes: 9 additions & 0 deletions utils/types/scan_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ func TestScanStatus_SetProcessing(t *testing.T) {
func TestScanStatus_IsWaiting(t *testing.T) {
require.True(t, NewScanStatusWaiting().IsWaiting())
require.False(t, NewScanStatusProcessing().IsWaiting())
require.False(t, ScanStatus{}.IsWaiting())
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

func TestScanStatus_IsProcess(t *testing.T) {
require.False(t, NewScanStatusWaiting().IsProcessing())
require.True(t, NewScanStatusProcessing().IsProcessing())
require.False(t, ScanStatus{}.IsProcessing())
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 52a84e9

Please sign in to comment.