Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekSi committed Jul 25, 2016
1 parent 038bd75 commit 63c3e34
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions dumper_test.go
@@ -0,0 +1,29 @@
package gophers

import (
"testing"

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

func TestBodyRepr(t *testing.T) {
r := bodyRepr("application/json", []byte(`{"a":1}`))
expected := []byte(`{
"a": 1
}`)
assert.Equal(t, expected, r, "\n%q\n%q", expected, r)

r = bodyRepr("application/x-mpegURL", []byte(`
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=628000,CODECS="avc1.4D401E,mp4a.40.2",RESOLUTION=640x360
http://host/2695_1.m3u8
`))
expected = []byte(`
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=628000,CODECS="avc1.4D401E,mp4a.40.2",RESOLUTION=640x360
http://host/2695_1.m3u8
`)
assert.Equal(t, expected, r, "\n%q\n%q", expected, r)
}

0 comments on commit 63c3e34

Please sign in to comment.