DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

1c410e90d99c724f56dfda40c2e3cc906b55ffa2 — Jonni Liljamo 1 year, 11 months ago b68e848
feat(sdbapi): initial testing
1 files changed, 30 insertions(+), 0 deletions(-)

A sdbapi/main_test.go
A sdbapi/main_test.go => sdbapi/main_test.go +30 -0
@@ 0,0 1,30 @@
/*
 * This file is part of sdbapi
 * Copyright (C) 2022 Jonni Liljamo <jonni@liljamo.com>
 *
 * Licensed under GPL-3.0-only.
 * See LICENSE for licensing information.
 */

package main

import (
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestMiscInfo(t *testing.T) {
	r := createRouter()

	w := httptest.NewRecorder()
	req, _ := http.NewRequest("GET", "/api/info", nil)
	r.ServeHTTP(w, req)

	expected := "{\"info\":\"Deck Builder API\",\"ver\":\"0.0.1\"}"

	assert.Equal(t, http.StatusOK, w.Code)
	assert.Equal(t, expected, w.Body.String())
}