-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaddons_test.go
30 lines (26 loc) · 1.11 KB
/
addons_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
24
25
26
27
28
29
30
package ffcss
import (
"bytes"
"testing"
"github.com/stretchr/testify/assert"
)
func TestInstallAddon(t *testing.T) {
// Empty the buffer
mockedStdout = bytes.Buffer{}
BaseIndentLevel = 0
mockedProfile.InstallAddon("linux", "https://example.com")
// assert.NoError(t, err) FIXME firefox won't open with the given profile even if the mocked .mozilla/firefox dir is copied exactly from my ~
assert.Equal(t,
" \x1b[36m•\x1b[0m Opening \x1b[34m\x1b[1mhttps://example.com\x1b[0m\n \x1b[36m•\x1b[0m \x1b[33mWaiting for you to close Firefox\x1b[0m\n",
mockedStdout.String(),
)
// Empty the buffer
mockedStdout = bytes.Buffer{}
BaseIndentLevel = 0
err := mockedProfile.InstallAddon("goretijgoierjogirej", "https://example.com")
assert.NoError(t, err)
assert.Equal(t,
" \x1b[36m•\x1b[0m Opening \x1b[34m\x1b[1mhttps://example.com\x1b[0m\n \x1b[36m•\x1b[0m \x1b[33mWaiting for you to close Firefox\x1b[0m\n\x1b[33m\x1b[1munrecognized OS goretijgoierjogirej, cannot open firefox automatically. Open https://example.com in firefox using profile default-release (667ekipp)\n\x1b[0m",
mockedStdout.String(),
)
}