Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/ws-daemon/pkg/content/config_test.go
2500 views
1
// Copyright (c) 2020 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package content_test
6
7
import (
8
"encoding/json"
9
"fmt"
10
"testing"
11
12
"github.com/gitpod-io/gitpod/ws-daemon/api"
13
"github.com/gitpod-io/gitpod/ws-daemon/pkg/content"
14
"github.com/google/go-cmp/cmp"
15
)
16
17
func TestFSShiftMethodUnmarshalJSON(t *testing.T) {
18
tests := []struct {
19
Input string
20
Expectation content.FSShiftMethod
21
}{
22
{"shiftfs", content.FSShiftMethod(api.FSShiftMethod_SHIFTFS)},
23
}
24
25
for _, test := range tests {
26
t.Run(test.Input, func(t *testing.T) {
27
var act struct {
28
M content.FSShiftMethod
29
}
30
err := json.Unmarshal([]byte(fmt.Sprintf("{\"M\":\"%s\"}", test.Input)), &act)
31
if err != nil {
32
t.Fatal(err)
33
}
34
35
if diff := cmp.Diff(test.Expectation, act.M); diff != "" {
36
t.Errorf("unexpected result (-want +got):\n%s", diff)
37
}
38
})
39
}
40
}
41
42