github.com/blend/go-sdk@v1.20220411.3/breaker/errors_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package breaker
     9  
    10  import (
    11  	"testing"
    12  
    13  	"github.com/blend/go-sdk/assert"
    14  	"github.com/blend/go-sdk/ex"
    15  )
    16  
    17  func TestErrIsOpen(t *testing.T) {
    18  	assert := assert.New(t)
    19  
    20  	assert.True(ErrIsOpen(ex.New(ErrOpenState)))
    21  	assert.False(ErrIsOpen(nil))
    22  	assert.False(ErrIsOpen(ex.New(ErrTooManyRequests)))
    23  }
    24  
    25  func TestErrIsTooManyRequests(t *testing.T) {
    26  	assert := assert.New(t)
    27  
    28  	assert.True(ErrIsTooManyRequests(ex.New(ErrTooManyRequests)))
    29  	assert.False(ErrIsTooManyRequests(nil))
    30  	assert.False(ErrIsTooManyRequests(ex.New(ErrOpenState)))
    31  }