Home / File/ adapter_test.go — fiber Source File

adapter_test.go — fiber Source File

Architecture documentation for adapter_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Adapters 1 imports 41 functions 7 classes

Entity Profile

Dependency Diagram

graph LR
  3ad7a4ef_7f07_008c_234d_52c9a342aa98["adapter_test.go"]
  fcef1725_af89_d6cd_36cd_b228cdcc5acd["errors"]
  3ad7a4ef_7f07_008c_234d_52c9a342aa98 --> fcef1725_af89_d6cd_36cd_b228cdcc5acd
  style 3ad7a4ef_7f07_008c_234d_52c9a342aa98 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package fiber

import (
	"errors"
	"fmt"
	"io"
	"net/http"
	"net/http/httptest"
	"os"
	"reflect"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	"github.com/valyala/fasthttp"
)

func TestToFiberHandler_Nil(t *testing.T) {
	t.Parallel()

	var handler Handler
	converted, ok := toFiberHandler(handler)
	require.False(t, ok)
	require.Nil(t, converted)
}

func TestToFiberHandler_FiberHandler(t *testing.T) {
	t.Parallel()

	fiberHandler := func(c Ctx) error { return c.SendStatus(http.StatusAccepted) }

	converted, ok := toFiberHandler(fiberHandler)
	require.True(t, ok)
	require.NotNil(t, converted)
	require.Equal(t, reflect.ValueOf(fiberHandler).Pointer(), reflect.ValueOf(converted).Pointer())
}

func TestToFiberHandler_FiberHandlerNoErrorReturn(t *testing.T) {
	t.Parallel()

	app, ctx := newTestCtx(t)

	handler := func(c Ctx) {
		require.Equal(t, app, c.App())
		c.Set("X-Handler", "ok")
	}

	converted, ok := toFiberHandler(handler)
	require.True(t, ok)
	require.NotNil(t, converted)

	require.NoError(t, converted(ctx))
	require.Equal(t, "ok", string(ctx.Response().Header.Peek("X-Handler")))
}

func TestNewTestCtx_ReturnsDefaultCtx(t *testing.T) {
	t.Parallel()

	app, ctx := newTestCtx(t)
// ... (919 more lines)

Domain

Subdomains

Functions

Dependencies

  • errors

Frequently Asked Questions

What does adapter_test.go do?
adapter_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Adapters subdomain.
What functions are defined in adapter_test.go?
adapter_test.go defines 41 function(s): ResponseWriter, TestAdapter_MixedHandlerIntegration, TestCollectHandlers_FasthttpHandler, TestCollectHandlers_FiberHandlerNoErrorReturn, TestCollectHandlers_HTTPHandler, TestCollectHandlers_InvalidType, TestCollectHandlers_MixedHandlers, TestCollectHandlers_Nil, TestCollectHandlers_TypedNilFasthttpHandlers, TestCollectHandlers_TypedNilFuncHTTPHandler, and 31 more.
What does adapter_test.go depend on?
adapter_test.go imports 1 module(s): errors.
Where is adapter_test.go in the architecture?
adapter_test.go is located at adapter_test.go (domain: FiberCore, subdomain: Adapters).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free