Home / Function/ Test_AllowsSharedCache() — fiber Function Reference

Test_AllowsSharedCache() — fiber Function Reference

Architecture documentation for the Test_AllowsSharedCache() function in cache_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  d92e525d_33b6_7895_4266_a5f1b3e4f006["Test_AllowsSharedCache()"]
  8453a087_9678_fe96_1b20_2d125b6f8656["cache_test.go"]
  d92e525d_33b6_7895_4266_a5f1b3e4f006 -->|defined in| 8453a087_9678_fe96_1b20_2d125b6f8656
  style d92e525d_33b6_7895_4266_a5f1b3e4f006 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/cache/cache_test.go lines 3014–3047

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

	tests := []struct {
		directives string
		expect     bool
	}{
		{"public", true},
		{"private", false},
		{"s-maxage=60", true},
		{"public, max-age=60", true},
		{"public, must-revalidate", true},
		{"max-age=60", false},
		{"no-cache", false},
		{"no-cache, s-maxage=60", true},
		{"", false},
	}

	for _, tt := range tests {
		t.Run(tt.directives, func(t *testing.T) {
			t.Parallel()

			got := allowsSharedCache(tt.directives)
			require.Equal(t, tt.expect, got, "directives: %q", tt.directives)
		})
	}

	t.Run("private overrules public", func(t *testing.T) {
		t.Parallel()

		got := allowsSharedCache(strings.ToUpper("private, public"))
		require.False(t, got)
	})
}

Subdomains

Frequently Asked Questions

What does Test_AllowsSharedCache() do?
Test_AllowsSharedCache() is a function in the fiber codebase, defined in middleware/cache/cache_test.go.
Where is Test_AllowsSharedCache() defined?
Test_AllowsSharedCache() is defined in middleware/cache/cache_test.go at line 3014.

Analyze Your Own Codebase

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

Try Supermodel Free