Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

1.3 KB
Raw Blame
// SiYuan - https://github.com/siyuan-note/siyuan
// Copyright (c) 2020-present, b3log.org
// SPDX-License-Identifier: AGPL-3.0-or-later

package util

import "testing"

func TestNormalizeStatusBarDefaults(t *testing.T) {
	desktop := NormalizeStatusBar(nil, false)
	if desktop.Version != StatusBarVersion || desktop.MsgTaskDatabaseIndexCommitDisabled ||
		desktop.MsgTaskHistoryDatabaseIndexCommitDisabled || desktop.MsgTaskAssetDatabaseIndexCommitDisabled {
		t.Fatalf("unexpected desktop status bar defaults: %#v", desktop)
	}

	mobile := NormalizeStatusBar(&StatusBar{}, true)
	if mobile.Version != StatusBarVersion || !mobile.MsgTaskDatabaseIndexCommitDisabled ||
		!mobile.MsgTaskHistoryDatabaseIndexCommitDisabled || !mobile.MsgTaskAssetDatabaseIndexCommitDisabled {
		t.Fatalf("unexpected mobile status bar defaults: %#v", mobile)
	}

	mobile.MsgTaskAssetDatabaseIndexCommitDisabled = false
	mobile = NormalizeStatusBar(mobile, true)
	if mobile.MsgTaskAssetDatabaseIndexCommitDisabled {
		t.Fatal("normalized status bar settings should preserve user changes")
	}
}

func TestNewNotificationsEnablesFormatPainterTip(t *testing.T) {
	notifications := NewNotifications()
	if nil == notifications.FormatPainterTip || !*notifications.FormatPainterTip {
		t.Fatal("format painter notifications should be enabled by default")
	}
}