code.gitea.io/gitea@v1.22.3/models/migrations/v1_22/v283_test.go (about)

     1  // Copyright 2023 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_22 //nolint
     5  
     6  import (
     7  	"testing"
     8  
     9  	"code.gitea.io/gitea/models/migrations/base"
    10  
    11  	"github.com/stretchr/testify/assert"
    12  )
    13  
    14  func Test_AddCombinedIndexToIssueUser(t *testing.T) {
    15  	type IssueUser struct { // old struct
    16  		ID          int64 `xorm:"pk autoincr"`
    17  		UID         int64 `xorm:"INDEX"` // User ID.
    18  		IssueID     int64 `xorm:"INDEX"`
    19  		IsRead      bool
    20  		IsMentioned bool
    21  	}
    22  
    23  	// Prepare and load the testing database
    24  	x, deferable := base.PrepareTestEnv(t, 0, new(IssueUser))
    25  	defer deferable()
    26  
    27  	assert.NoError(t, AddCombinedIndexToIssueUser(x))
    28  }