mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-07-16 09:38:51 +02:00
72 lines
1.8 KiB
Go
72 lines
1.8 KiB
Go
//Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
|
|
//Copyright (C) 2024 HTWKalender support@htwkalender.de
|
|
|
|
//This program is free software: you can redistribute it and/or modify
|
|
//it under the terms of the GNU Affero General Public License as published by
|
|
//the Free Software Foundation, either version 3 of the License, or
|
|
//(at your option) any later version.
|
|
|
|
//This program is distributed in the hope that it will be useful,
|
|
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
//GNU Affero General Public License for more details.
|
|
|
|
//You should have received a copy of the GNU Affero General Public License
|
|
//along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
package db
|
|
|
|
import (
|
|
"github.com/pocketbase/pocketbase/daos"
|
|
"github.com/pocketbase/pocketbase/tests"
|
|
"testing"
|
|
)
|
|
|
|
const testDataDir = "./mockData"
|
|
|
|
func TestDeleteFeed(t *testing.T) {
|
|
|
|
setupTestApp := func(t *testing.T) *daos.Dao {
|
|
testApp, err := tests.NewTestApp(testDataDir)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
dao := daos.New(testApp.Dao().DB())
|
|
return dao
|
|
}
|
|
|
|
type args struct {
|
|
db *daos.Dao
|
|
feedId string
|
|
}
|
|
testsCases := []struct {
|
|
name string
|
|
args args
|
|
wantErr bool
|
|
}{
|
|
{
|
|
name: "TestDeleteFeed",
|
|
args: args{
|
|
db: setupTestApp(t),
|
|
feedId: "fkoqti06ohlnsb8",
|
|
},
|
|
wantErr: false,
|
|
},
|
|
{
|
|
name: "TestDeleteFeedNotExisting",
|
|
args: args{
|
|
db: setupTestApp(t),
|
|
feedId: "test324",
|
|
},
|
|
wantErr: true,
|
|
},
|
|
}
|
|
for _, tt := range testsCases {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if err := DeleteFeed(tt.args.db, tt.args.feedId); (err != nil) != tt.wantErr {
|
|
t.Errorf("DeleteFeed() error = %v, wantErr %v", err, tt.wantErr)
|
|
}
|
|
})
|
|
}
|
|
}
|