focalboard/server/services/store/sqlstore/sqlstore_test.go
Harshil Sharma 9918a0b3f8
DND support for category and boards in LHS (#3964)
* WIP

* WIP

* Removed unused webapp util

* Added server tests

* Lint fix

* Updating existing tests

* Updating existing tests

* Updating existing tests

* Fixing existing tests

* Fixing existing tests

* Fixing existing tests

* WIP

* Added category sort order migration

* Added logic to set new category on top

* Implemented api, WS listein logic remining

* finished webapp implementation

* Added category type and tests

* updated tests

* Fixed integration test

* type fix

* WIP

* implemented boards DND to other category and in same category

* removed seconds from boards name

* wip

* debugging cy test

* Enabled hiding views list while DNDing

* Removed some debug logs

* Fixed a bug preventing users from collapsing boards category

* WIP

* Debugging cypress test

* CI

* debugging cy test

* Testing a fix

* reverting test fix

* Handled personal server

* WIP

* WIP

* Adding support for building with esbuild

* Using different index.html templates for esbuild

* WIP

* WIP

* Fixed delete category and rename category

* WIP

* WIP

* Finally, its done.

* Adde suppor tot update board-category mapping in bulk

* Fixed a bug where create category option didn't show up on default category

* Fixed bug where new board was added as last board in Boards category instead of first board

* Minor cleanup

* WIP

* Added support to drab boards onto collapsed categories

* Fixed route order from specific to generic

* Fix linter

* Updated existin server tests

* fixed integration tests

* Fixed webapp test err

* Removed accidental dependencies

* Adding  new server tests

* Finished server tests

* added api to client.go

* Added API integration test

* Fixed existing webapp tests

* WIP

* WIP

* WIP

* WIP

* WIP

* Fixed missing paranthesis

* Some cleanup

* fixed server lint

* noopped down migration

* Fixed issue with DND not working great with newly added category

* Fixed a test

* Fixed a test

* Fixed a test

* Fixed console error while DNDing

* pakg lock restore

* Fixed missing react beautiful dnd in package.lock.json

* updated snapshots

* Fixed webapp test

* Review fixes

* Added API permission check

Co-authored-by: Jesús Espino <jespinog@gmail.com>
2022-11-24 15:31:32 +05:30

66 lines
2.9 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package sqlstore
import (
"testing"
"github.com/mattermost/focalboard/server/services/store/storetests"
"github.com/mattermost/focalboard/server/model"
"github.com/stretchr/testify/require"
)
func TestSQLStore(t *testing.T) {
t.Run("BlocksStore", func(t *testing.T) { storetests.StoreTestBlocksStore(t, SetupTests) })
t.Run("SharingStore", func(t *testing.T) { storetests.StoreTestSharingStore(t, SetupTests) })
t.Run("SystemStore", func(t *testing.T) { storetests.StoreTestSystemStore(t, SetupTests) })
t.Run("UserStore", func(t *testing.T) { storetests.StoreTestUserStore(t, SetupTests) })
t.Run("SessionStore", func(t *testing.T) { storetests.StoreTestSessionStore(t, SetupTests) })
t.Run("TeamStore", func(t *testing.T) { storetests.StoreTestTeamStore(t, SetupTests) })
t.Run("BoardStore", func(t *testing.T) { storetests.StoreTestBoardStore(t, SetupTests) })
t.Run("BoardsAndBlocksStore", func(t *testing.T) { storetests.StoreTestBoardsAndBlocksStore(t, SetupTests) })
t.Run("SubscriptionStore", func(t *testing.T) { storetests.StoreTestSubscriptionsStore(t, SetupTests) })
t.Run("NotificationHintStore", func(t *testing.T) { storetests.StoreTestNotificationHintsStore(t, SetupTests) })
t.Run("DataRetention", func(t *testing.T) { storetests.StoreTestDataRetention(t, SetupTests) })
t.Run("CloudStore", func(t *testing.T) { storetests.StoreTestCloudStore(t, SetupTests) })
t.Run("StoreTestFileStore", func(t *testing.T) { storetests.StoreTestFileStore(t, SetupTests) })
t.Run("StoreTestCategoryStore", func(t *testing.T) { storetests.StoreTestCategoryStore(t, SetupTests) })
t.Run("StoreTestCategoryBoardsStore", func(t *testing.T) { storetests.StoreTestCategoryBoardsStore(t, SetupTests) })
t.Run("BoardsInsightsStore", func(t *testing.T) { storetests.StoreTestBoardsInsightsStore(t, SetupTests) })
}
// tests for utility functions inside sqlstore.go
func TestConcatenationSelector(t *testing.T) {
store, tearDown := SetupTests(t)
sqlStore := store.(*SQLStore)
defer tearDown()
concatenationString := sqlStore.concatenationSelector("a", ",")
switch sqlStore.dbType {
case model.SqliteDBType:
require.Equal(t, concatenationString, "group_concat(a)")
case model.MysqlDBType:
require.Equal(t, concatenationString, "GROUP_CONCAT(a SEPARATOR ',')")
case model.PostgresDBType:
require.Equal(t, concatenationString, "string_agg(a, ',')")
}
}
func TestElementInColumn(t *testing.T) {
store, tearDown := SetupTests(t)
sqlStore := store.(*SQLStore)
defer tearDown()
inLiteral := sqlStore.elementInColumn("test_column")
switch sqlStore.dbType {
case model.SqliteDBType:
require.Equal(t, inLiteral, "instr(test_column, ?) > 0")
case model.MysqlDBType:
require.Equal(t, inLiteral, "instr(test_column, ?) > 0")
case model.PostgresDBType:
require.Equal(t, inLiteral, "position(? in test_column) > 0")
}
}