-
Notifications
You must be signed in to change notification settings - Fork 39
/
eum_test.go
23 lines (18 loc) · 922 Bytes
/
eum_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// (c) Copyright IBM Corp. 2021
// (c) Copyright Instana Inc. 2018
package instana_test
import (
"testing"
instana "github.com/instana/go-sensor"
"github.com/stretchr/testify/assert"
)
const eumExpectedResult string = `<script>
(function(c,e,f,k,g,h,b,a,d){c[g]||(c[g]=h,b=c[h]=function(){b.q.push(arguments)},b.q=[],b.l=1*new Date,a=e.createElement(f),a.async=1,a.src=k,a.setAttribute("crossorigin","anonymous"),d=e.getElementsByTagName(f)[0],d.parentNode.insertBefore(a,d))})(window,document,"script","//eum.instana.io/eum.min.js","InstanaEumObject","ineum");ineum('reportingUrl','https://eum-saas.instana.io');ineum('key','myApiKey');ineum('traceId','myTraceId');ineum('meta','key1','value1');ineum('meta','key2','value2');
</script>
`
func TestEum(t *testing.T) {
assert.Equal(t, eumExpectedResult, instana.EumSnippet("myApiKey", "myTraceId", map[string]string{
"key1": "value1",
"key2": "value2",
}))
}