/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
go/status/status_test.go
49 строк
1 KB
chrisnojima-zoom
Version 670 - clean2 (#29122)
08 июн 2026, 19:31
Не верифицирован
08 июн 2026, 19:31
1943197
Код
Авторство
О чём код?
// Copyright 2019 Keybase, Inc. All rights reserved. Use of // this source code is governed by the included BSD license. package status import ( "encoding/json" "strings" "testing" "github.com/keybase/client/go/libkb" jsonw "github.com/keybase/go-jsonw" "github.com/stretchr/testify/require" ) func TestMergeExtendedStatus(t *testing.T) { tc := libkb.SetupTest(t, "MergedExtendedStatus", 1) defer tc.Cleanup() lsCtx := LogSendContext{ Contextified: libkb.NewContextified(tc.G), } // invalid json is skipped fullStatus := lsCtx.mergeExtendedStatus("") require.Equal(t, fullStatus, "") // Status is merged in under the key 'status' status := `{"status":{"foo":"bar"}}` fullStatus = lsCtx.mergeExtendedStatus(status) require.True(t, strings.Contains(fullStatus, status)) err := jsonw.EnsureMaxDepthBytesDefault([]byte(fullStatus)) require.NoError(t, err) fullStatusMap := map[string]any{} err = json.Unmarshal([]byte(fullStatus), &fullStatusMap) require.NoError(t, err) _, ok := fullStatusMap["status"] require.True(t, ok) } func TestFullStatus(t *testing.T) { tc := libkb.SetupTest(t, "FullStatus", 1) defer tc.Cleanup() mctx := libkb.NewMetaContextForTest(tc) fstatus, err := GetFullStatus(mctx) require.NoError(t, err) require.NotNil(t, fstatus) }