-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy patherror_utils_test.go
More file actions
48 lines (42 loc) · 1.04 KB
/
error_utils_test.go
File metadata and controls
48 lines (42 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package interop
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda-managed-instances/rapid/model"
)
func TestBuildStatusFromError(t *testing.T) {
testCases := []struct {
name string
err model.AppError
expected ResponseStatus
}{
{
name: "nilError",
err: nil,
expected: Success,
},
{
name: "sandboxTimeoutError",
err: model.NewCustomerError(model.ErrorSandboxTimedout),
expected: Timeout,
},
{
name: "customerError",
err: model.NewCustomerError(model.ErrorFunctionUnknown),
expected: Error,
},
{
name: "platformError",
err: model.NewPlatformError(nil, model.ErrorReasonUnknownError),
expected: Failure,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
actual := BuildStatusFromError(tc.err)
assert.Equal(t, tc.expected, actual)
})
}
}