* Cleanup .gitignore * Document minimum server version * Become golint compliant * Use pre defined http method * Update dependencies * Add i18n-extract target * Add golint target * Run check-style against all go files Co-Authored-By: Jesse Hallam <jesse.hallam@gmail.com>
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			502 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			502 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package main
 | |
| 
 | |
| import (
 | |
| 	"io/ioutil"
 | |
| 	"net/http"
 | |
| 	"net/http/httptest"
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/stretchr/testify/assert"
 | |
| )
 | |
| 
 | |
| func TestServeHTTP(t *testing.T) {
 | |
| 	assert := assert.New(t)
 | |
| 	plugin := Plugin{}
 | |
| 	w := httptest.NewRecorder()
 | |
| 	r := httptest.NewRequest(http.MethodGet, "/", nil)
 | |
| 
 | |
| 	plugin.ServeHTTP(nil, w, r)
 | |
| 
 | |
| 	result := w.Result()
 | |
| 	assert.NotNil(result)
 | |
| 	bodyBytes, err := ioutil.ReadAll(result.Body)
 | |
| 	assert.Nil(err)
 | |
| 	bodyString := string(bodyBytes)
 | |
| 
 | |
| 	assert.Equal("Hello, world!", bodyString)
 | |
| }
 |