Files
libopenapi/index/circular_reference_result_test.go
Dave Shanley 0de0c16c0c 99.9 % coverage & full OpenAPI v3 support
A single line that tries to read an HTTP response body and fails is very hard to test without mocking, and the mock does not add value to a single line of code to check for an error that can rarely ever be triggered. Going to settle for 99.9% for now.
2022-08-31 10:04:39 -04:00

31 lines
649 B
Go

// Copyright 2022 Princess B33f Heavy Industries / Dave Shanley
// SPDX-License-Identifier: MIT
package index
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestCircularReferenceResult_GenerateJourneyPath(t *testing.T) {
refs := []*Reference{
{Name: "chicken"},
{Name: "nuggets"},
{Name: "chicken"},
{Name: "soup"},
{Name: "chicken"},
{Name: "nuggets"},
{Name: "for"},
{Name: "me"},
{Name: "and"},
{Name: "you"},
}
cr := &CircularReferenceResult{Journey: refs}
assert.Equal(t, "chicken -> nuggets -> chicken -> soup -> "+
"chicken -> nuggets -> for -> me -> and -> you", cr.GenerateJourneyPath())
}