Skip to content

Commit

Permalink
more testing (commented)
Browse files Browse the repository at this point in the history
  • Loading branch information
watzon committed Nov 17, 2024
1 parent 256cb50 commit ccd28fb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/server/services/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

// NewPasteOptions contains configuration options for creating a new paste
type NewPasteOptions struct {
Content string // Content to be pasted
Extension string // File extension (optional)
ExpiresAt *time.Time // Expiration time for the paste
Private bool // Whether the paste is private
Expand Down
30 changes: 30 additions & 0 deletions internal/server/tests/paste_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,33 @@ func TestRawPasteUpload(t *testing.T) {
})
}
}

// func TestViewPaste(t *testing.T) {
// env := testutils.SetupTestEnv(t)
// defer env.CleanupFn()

// // Create paste
// body := `{"content": "test content", "filename": "test.txt", "extension": "txt", "private": false}`
// req := httptest.NewRequest("POST", "/p/", strings.NewReader(body))
// req.Header.Set("Content-Type", "application/json")

// resp, err := env.App.Test(req)
// require.NoError(t, err)

// // Parse response
// var paste services.NewPasteResponse
// err = json.NewDecoder(resp.Body).Decode(&paste)
// require.NoError(t, err)

// fmt.Println(paste)

// // View paste
// req = httptest.NewRequest("GET", fmt.Sprintf("/p/%s.txt", paste.ID), nil)
// resp, err = env.App.Test(req)
// require.NoError(t, err)

// bodytext, _ := io.ReadAll(resp.Body)
// fmt.Println(string(bodytext))

// assert.Equal(t, 200, resp.StatusCode)
// }

0 comments on commit ccd28fb

Please sign in to comment.