mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 12:37:48 +00:00
bumped coverage
This commit is contained in:
23
datamodel/low/base/context_test.go
Normal file
23
datamodel/low/base/context_test.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// Copyright 2023-2024 Princess Beef Heavy Industries, LLC / Dave Shanley
|
||||||
|
// https://pb33f.io
|
||||||
|
|
||||||
|
package base
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetModelContext(t *testing.T) {
|
||||||
|
|
||||||
|
assert.Nil(t, GetModelContext(nil))
|
||||||
|
assert.Nil(t, GetModelContext(context.Background()))
|
||||||
|
|
||||||
|
ctx := context.WithValue(context.Background(), "modelCtx", &ModelContext{})
|
||||||
|
assert.NotNil(t, GetModelContext(ctx))
|
||||||
|
|
||||||
|
ctx = context.WithValue(context.Background(), "modelCtx", "wrong")
|
||||||
|
assert.Nil(t, GetModelContext(ctx))
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user