Tests: Update test fixtures

This commit is contained in:
theresa 2021-07-23 13:25:28 +02:00
parent ca390351d8
commit 09c51c8db6
2 changed files with 37 additions and 11 deletions

View file

@ -8,48 +8,74 @@ type LinkMap map[string]Link
var LinkFixtures = LinkMap{
"1jxf3jfn2k": {
LinkUID: "abcfgty",
LinkUID: "sqn2xpryd1ob7gtf",
ShareUID: "at9lxuqxpogaaba8",
ShareSlug: "holiday-2030",
LinkToken: "1jxf3jfn2k",
LinkExpires: 0,
ShareUID: "st9lxuqxpogaaba7",
LinkViews: 12,
MaxViews: 0,
HasPassword: false,
CanComment: true,
CanEdit: false,
CreatedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
ModifiedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
},
"4jxf3jfn2k": {
LinkUID: "sqn2xpryd1ob8gtf",
ShareUID: "at9lxuqxpogaaba7",
ShareSlug: "christmas-2030",
LinkToken: "4jxf3jfn2k",
LinkExpires: 0,
ShareUID: "at9lxuqxpogaaba7",
LinkViews: 0,
MaxViews: 0,
HasPassword: false,
CanComment: true,
CanEdit: false,
CreatedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
ModifiedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
},
"5jxf3jfn2k": {
LinkToken: "5jxf3jfn2k",
LinkExpires: 0,
LinkUID: "sqn9xpryd1ob9gtf",
ShareUID: "ft2es39w45bnlqdw",
ShareSlug: "ft2es39w45bnlqdw",
LinkToken: "5jxf3jfn2k",
LinkExpires: 0,
LinkViews: 0,
MaxViews: 0,
HasPassword: false,
CanComment: true,
CanEdit: false,
CreatedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
ModifiedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
},
"6jxf3jfn2k": {
LinkUID: "sqn1xpryd1ob1gtf",
ShareUID: "lt9k3pw1wowuy3c3",
ShareSlug: "lt9k3pw1wowuy3c3",
LinkToken: "6jxf3jfn2k",
LinkExpires: 0,
ShareUID: "st9lxuqxpogaaba7",
ShareSlug: "lt9k3pw1wowuy3c3",
LinkViews: 0,
MaxViews: 0,
HasPassword: false,
CanComment: true,
CanEdit: false,
CreatedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
ModifiedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
},
"7jxf3jfn2k": {
LinkUID: "sqn2xpryd1ob2gtf",
ShareUID: "pt9k3pw1wowuy3c3",
ShareSlug: "pt9k3pw1wowuy3c3",
LinkToken: "7jxf3jfn2k",
LinkExpires: 0,
ShareUID: "st9lxuqxpogaaba7",
ShareSlug: "pt9k3pw1wowuy3c3",
LinkViews: 0,
MaxViews: 0,
HasPassword: false,
CanComment: true,
CanEdit: false,
CreatedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
ModifiedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
},
}

View file

@ -169,7 +169,7 @@ func TestFindLink(t *testing.T) {
func TestFindLinks(t *testing.T) {
t.Run("success", func(t *testing.T) {
r := FindLinks("1jxf3jfn2k", "")
assert.Equal(t, "st9lxuqxpogaaba7", r[0].ShareUID)
assert.Equal(t, "at9lxuqxpogaaba8", r[0].ShareUID)
})
t.Run("not found", func(t *testing.T) {
r := FindLinks("", "")
@ -184,7 +184,7 @@ func TestFindLinks(t *testing.T) {
func TestFindValidLinksLinks(t *testing.T) {
t.Run("success", func(t *testing.T) {
r := FindValidLinks("1jxf3jfn2k", "")
assert.Equal(t, "st9lxuqxpogaaba7", r[0].ShareUID)
assert.Equal(t, "at9lxuqxpogaaba8", r[0].ShareUID)
})
}