Path: blob/main/components/ws-daemon/pkg/content/config_test.go
2500 views
// Copyright (c) 2020 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package content_test56import (7"encoding/json"8"fmt"9"testing"1011"github.com/gitpod-io/gitpod/ws-daemon/api"12"github.com/gitpod-io/gitpod/ws-daemon/pkg/content"13"github.com/google/go-cmp/cmp"14)1516func TestFSShiftMethodUnmarshalJSON(t *testing.T) {17tests := []struct {18Input string19Expectation content.FSShiftMethod20}{21{"shiftfs", content.FSShiftMethod(api.FSShiftMethod_SHIFTFS)},22}2324for _, test := range tests {25t.Run(test.Input, func(t *testing.T) {26var act struct {27M content.FSShiftMethod28}29err := json.Unmarshal([]byte(fmt.Sprintf("{\"M\":\"%s\"}", test.Input)), &act)30if err != nil {31t.Fatal(err)32}3334if diff := cmp.Diff(test.Expectation, act.M); diff != "" {35t.Errorf("unexpected result (-want +got):\n%s", diff)36}37})38}39}404142