2021-10-08 12:39:31 +00:00
|
|
|
// SPDX-FileCopyrightText: 2021 The NGI Pointer Secure-Scuttlebutt Team of 2020/2021
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2021-02-09 15:49:48 +00:00
|
|
|
package sqlite
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
_ "github.com/mattn/go-sqlite3"
|
2021-03-24 10:39:08 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
2022-11-07 09:18:13 +00:00
|
|
|
"github.com/ssbc/go-ssb-room/v2/internal/repo"
|
2021-02-09 15:49:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// verify the database opens and migrates successfully from zero state
|
2021-03-18 16:49:52 +00:00
|
|
|
func TestSchema(t *testing.T) {
|
|
|
|
testRepo := filepath.Join("testrun", t.Name())
|
|
|
|
os.RemoveAll(testRepo)
|
|
|
|
|
|
|
|
tr := repo.New(testRepo)
|
|
|
|
|
|
|
|
db, err := Open(tr)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
err = db.Close()
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|