Home / File/ mount_test.go — fiber Source File

mount_test.go — fiber Source File

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

File go FiberCore Routing 1 imports 17 functions

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 🤖 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

package fiber

import (
	"errors"
	"io"
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/stretchr/testify/require"
)

// go test -run Test_App_Mount
func Test_App_Mount(t *testing.T) {
	t.Parallel()
	micro := New()
	micro.Get("/doe", func(c Ctx) error {
		return c.SendStatus(StatusOK)
	})

	app := New()
	app.Use("/john", micro)
	resp, err := app.Test(httptest.NewRequest(MethodGet, "/john/doe", http.NoBody))
	require.NoError(t, err, "app.Test(req)")
	require.Equal(t, 200, resp.StatusCode, "Status code")
	require.Equal(t, uint32(2), app.handlersCount)
}

func Test_App_Mount_RootPath_Nested(t *testing.T) {
	t.Parallel()
	app := New()
	dynamic := New()
	apiserver := New()

	apiroutes := apiserver.Group("/v1")
	apiroutes.Get("/home", func(c Ctx) error {
		return c.SendString("home")
	})

	dynamic.Use("/api", apiserver)
	app.Use("/", dynamic)

	resp, err := app.Test(httptest.NewRequest(MethodGet, "/api/v1/home", http.NoBody))
	require.NoError(t, err, "app.Test(req)")
	require.Equal(t, 200, resp.StatusCode, "Status code")
	require.Equal(t, uint32(2), app.handlersCount)
}

// go test -run Test_App_Mount_Nested
func Test_App_Mount_Nested(t *testing.T) {
	t.Parallel()
	app := New()
	one := New()
	two := New()
	three := New()

// ... (539 more lines)

Domain

Subdomains

Dependencies

  • errors

Frequently Asked Questions

What does mount_test.go do?
mount_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Routing subdomain.
What functions are defined in mount_test.go?
mount_test.go defines 17 function(s): Test_App_ErrorHandler_GroupMount, Test_App_ErrorHandler_GroupMountRootLevel, Test_App_Group_Mount, Test_App_Mount, Test_App_MountPath, Test_App_Mount_Express_Behavior, Test_App_Mount_Nested, Test_App_Mount_RootPath_Nested, Test_App_Mount_RoutePositions, Test_App_UseMountedErrorHandler, and 7 more.
What does mount_test.go depend on?
mount_test.go imports 1 module(s): errors.
Where is mount_test.go in the architecture?
mount_test.go is located at mount_test.go (domain: FiberCore, subdomain: Routing).

Analyze Your Own Codebase

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

Try Supermodel Free