Skip to content

Commit

Permalink
Update main_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
NailaRais authored Nov 6, 2024
1 parent 74338ac commit efbb226
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions pkg/component/operator/text/v0/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"testing"
"github.com/frankban/quicktest"
"strings" // Ensure this import is here
"github.com/instill-ai/pipeline-backend/pkg/component/base"
"github.com/instill-ai/pipeline-backend/pkg/component/internal/mock"
)
Expand Down Expand Up @@ -149,33 +148,3 @@ func TestCleanData(t *testing.T) {
})
}
}

// Helper function to normalize line endings across different environments
func normalizeLineEndings(input string) string {
return strings.ReplaceAll(input, "\r\n", "\n")
}

// Sample test in main_test.go with normalizeLineEndings
func TestValidateChunkPositionsInMain(t *testing.T) {
c := quicktest.New(t)

// Sample data - replace with actual chunk data
chunks := []TextChunk{
{StartPosition: 0, EndPosition: 10, TokenCount: 5},
{StartPosition: 11, EndPosition: 20, TokenCount: 7},
}

expectedChunks := []TextChunk{
{StartPosition: 0, EndPosition: 10, TokenCount: 5},
{StartPosition: 11, EndPosition: 20, TokenCount: 7},
}

// Perform line-ending normalization on test data if necessary
for i := range chunks {
chunks[i].Text = normalizeLineEndings(chunks[i].Text)
expectedChunks[i].Text = normalizeLineEndings(expectedChunks[i].Text)
}

// Validate using validateChunkPositions or another test function
validateChunkPositions(c, chunks, expectedChunks)
}

0 comments on commit efbb226

Please sign in to comment.