Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

555 B
Raw Blame
package sqlite

import (
	"errors"
	"testing"

	"github.com/stretchr/testify/require"

	"github.com/usememos/memos/store"
)

type failingSQLiteSpaceSummaryRow struct {
	err error
}

func (row failingSQLiteSpaceSummaryRow) Scan(...any) error {
	return row.err
}

func TestScanSQLiteSpaceSummaryWrapsErrors(t *testing.T) {
	cause := errors.New("scan failed")
	err := scanSQLiteSpaceSummary(failingSQLiteSpaceSummaryRow{err: cause}, &store.Space{})

	require.ErrorIs(t, err, cause)
	require.ErrorContains(t, err, "failed to populate SQLite space summary")
}