package model

import (
    "testing"
)

func Test_Track_DescriptionHTML(t *testing.T) {
    track := Track{
        Description: "this is\na test\n<strong>description!</strong>",
    }

    // descriptions are set by privileged users,
    // so we'll allow HTML injection here
    want := "this is<br>a test<br><strong>description!</strong>"
    got := track.GetDescriptionHTML()
    if want != string(got) {
        t.Errorf(`track description incorrectly formatted (want "%s", got "%s")`, want, got)
    }
}

func Test_Track_LyricsHTML(t *testing.T) {
    track := Track{
        Lyrics: "these are\ntest\n<strong>lyrics!</strong>",
    }

    // lyrics are set by privileged users,
    // so we'll allow HTML injection here
    want := "these are<br>test<br><strong>lyrics!</strong>"
    got := track.GetLyricsHTML()
    if want != string(got) {
        t.Errorf(`track lyrics incorrectly formatted (want "%s", got "%s")`, want, got)
    }
}

func Test_Track_Add(t *testing.T) {
    track := Track{}

    want := 4
    got := track.Add(2, 2)
    if want != got {
        t.Errorf(`somehow, we screwed up addition. (want %d, got %d)`, want, got)
    }
}
