File: location_test.go

package info (click to toggle)
golang-github-owenrumney-go-sarif 2.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 712 kB
  • sloc: makefile: 13
file content (22 lines) | stat: -rw-r--r-- 521 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package sarif

import (
	"testing"

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

func Test_create_simple_location(t *testing.T) {
	l := NewLocation().
		WithId(1).
		WithMessage(
			NewMessage().
				WithId("messageId1").
				WithText("message text")).
		WithAnnotation(
			NewRegion().WithByteLength(10),
		).
		WithRelationship(NewLocationRelationship(1))

	assert.Equal(t, `{"id":1,"message":{"text":"message text","id":"messageId1"},"annotations":[{"byteLength":10}],"relationships":[{"target":1}]}`, getJsonString(l))
}