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.

571 B
Raw Blame
package postgres

import (
	"errors"
	"testing"

	"github.com/stretchr/testify/require"

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

type failingPostgresSpaceSummaryRow struct {
	err error
}

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

func TestScanPostgresSpaceSummaryWrapsErrors(t *testing.T) {
	cause := errors.New("scan failed")
	err := scanPostgresSpaceSummary(failingPostgresSpaceSummaryRow{err: cause}, &store.Space{})

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