main

mattermost/focalboard

Last updated at: 29/12/2023 09:46

de_duplicate_category_boards_migration_test.go

TLDR

This file is a part of the Demo Projects project and it contains a test function TestRunDeDuplicateCategoryBoardsMigration that tests the DeDuplicateCategoryBoardsMigration function.

Methods

None

Classes

None

package migrationstests

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestRunDeDuplicateCategoryBoardsMigration(t *testing.T) {
	th, tearDown := SetupTestHelper(t)
	defer tearDown()

	if th.IsSQLite() {
		t.Skip("SQLite is not supported for this")
	}

	th.f.MigrateToStepSkippingLastInterceptor(35).
		ExecFile("./fixtures/testDeDuplicateCategoryBoardsMigration.sql")

	th.f.RunInterceptor(35)

	// verifying count of rows
	var count int
	countQuery := "SELECT COUNT(*) FROM focalboard_category_boards"
	row := th.f.DB().QueryRow(countQuery)
	err := row.Scan(&count)
	assert.NoError(t, err)
	assert.Equal(t, 4, count)
}