github.com/blend/go-sdk@v1.20220411.3/testutil/suite_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 testutil 9 10 import ( 11 "context" 12 "testing" 13 14 "github.com/blend/go-sdk/assert" 15 ) 16 17 func Test_Suite_panics_before(t *testing.T) { 18 its := assert.New(t) 19 20 panicsBefore := Suite{ 21 Before: []SuiteAction{ 22 func(_ context.Context) error { return nil }, 23 func(_ context.Context) error { panic("at the disco") }, 24 }, 25 After: []SuiteAction{ 26 func(_ context.Context) error { return nil }, 27 }, 28 } 29 its.Equal(SuiteFailureBefore, panicsBefore.RunCode()) 30 } 31 32 func Test_Suite_panics_after(t *testing.T) { 33 its := assert.New(t) 34 35 panicsBefore := Suite{ 36 Before: []SuiteAction{ 37 func(_ context.Context) error { return nil }, 38 }, 39 After: []SuiteAction{ 40 func(_ context.Context) error { return nil }, 41 func(_ context.Context) error { panic("at the disco") }, 42 }, 43 } 44 its.Equal(SuiteFailureAfter, panicsBefore.RunCode()) 45 }