package controllers_test

import (
	"fmt"
	"net/http"
	"testing"

	"github.com/stretchr/testify/assert"
	"gitlab.com/pactual1/backend/shared"
)

func TestListProductTemplates(t *testing.T) {
	ts := runTestServer()
	defer ts.Close()
	defer shared.CloseDb()

	t.Run("it should return 200", func(t *testing.T) {
		resp, err := http.Get(fmt.Sprintf("%s/products?limit=20", ts.URL))

		if err != nil {
			t.Fatalf("Expected no error, got %v", err)
		}

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