Home / File/ helper_test.go — fiber Source File

helper_test.go — fiber Source File

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

File go FiberClient Hooks 1 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  0a463cba_a8ce_ebd2_d862_50fbe27b1d9f["helper_test.go"]
  9b537a1a_45c1_e888_9d77_8ee0a6d8e26b["net"]
  0a463cba_a8ce_ebd2_d862_50fbe27b1d9f --> 9b537a1a_45c1_e888_9d77_8ee0a6d8e26b
  style 0a463cba_a8ce_ebd2_d862_50fbe27b1d9f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package client

import (
	"net"
	"testing"
	"time"

	"github.com/fxamacker/cbor/v2"
	"github.com/gofiber/fiber/v3"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	"github.com/valyala/fasthttp/fasthttputil"
)

type testServer struct {
	app *fiber.App
	ch  chan struct{}
	ln  *fasthttputil.InmemoryListener
	tb  testing.TB
}

func startTestServer(tb testing.TB, beforeStarting func(app *fiber.App)) *testServer {
	tb.Helper()

	ln := fasthttputil.NewInmemoryListener()
	app := fiber.New(fiber.Config{
		CBOREncoder: cbor.Marshal,
		CBORDecoder: cbor.Unmarshal,
	})

	if beforeStarting != nil {
		beforeStarting(app)
	}

	ch := make(chan struct{})
	go func() {
		err := app.Listener(ln, fiber.ListenConfig{DisableStartupMessage: true})
		assert.NoError(tb, err)

		close(ch)
	}()

	return &testServer{
		app: app,
		ch:  ch,
		ln:  ln,
		tb:  tb,
	}
}

func (ts *testServer) stop() {
	ts.tb.Helper()

	if err := ts.app.Shutdown(); err != nil {
		ts.tb.Fatal(err)
	}

	select {
	case <-ts.ch:
	case <-time.After(time.Second):
// ... (105 more lines)

Domain

Subdomains

Dependencies

  • net

Frequently Asked Questions

What does helper_test.go do?
helper_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberClient domain, Hooks subdomain.
What functions are defined in helper_test.go?
helper_test.go defines 5 function(s): createHelperServer, startTestServer, testClient, testRequest, testRequestFail.
What does helper_test.go depend on?
helper_test.go imports 1 module(s): net.
Where is helper_test.go in the architecture?
helper_test.go is located at client/helper_test.go (domain: FiberClient, subdomain: Hooks, directory: client).

Analyze Your Own Codebase

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

Try Supermodel Free