mirror of
https://github.com/kovetskiy/mark.git
synced 2026-01-22 10:47:36 +08:00
fix: update test cases for large page IDs to reflect Confluence Cloud examples
Signed-off-by: Nikolai Emil Damm <ndam@tv2.dk>
This commit is contained in:
parent
6d5a9fba90
commit
2784c925a2
@ -74,9 +74,9 @@ func TestEncodeTinyLinkID(t *testing.T) {
|
|||||||
expected: "EIAB",
|
expected: "EIAB",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "large page ID from user example",
|
name: "large page ID (Confluence Cloud)",
|
||||||
pageID: 5645697027,
|
pageID: 5000000001,
|
||||||
expected: "A4CCUAE",
|
expected: "AfIFKgE",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "page ID 1",
|
name: "page ID 1",
|
||||||
@ -114,15 +114,15 @@ func TestGenerateTinyLink(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "cloud URL with trailing slash",
|
name: "cloud URL with trailing slash",
|
||||||
baseURL: "https://example.atlassian.net/wiki/",
|
baseURL: "https://example.atlassian.net/wiki/",
|
||||||
pageID: "5645697027",
|
pageID: "5000000001",
|
||||||
expected: "https://example.atlassian.net/wiki/x/A4CCUAE",
|
expected: "https://example.atlassian.net/wiki/x/AfIFKgE",
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "cloud URL without trailing slash",
|
name: "cloud URL without trailing slash",
|
||||||
baseURL: "https://example.atlassian.net/wiki",
|
baseURL: "https://example.atlassian.net/wiki",
|
||||||
pageID: "5645697027",
|
pageID: "5000000001",
|
||||||
expected: "https://example.atlassian.net/wiki/x/A4CCUAE",
|
expected: "https://example.atlassian.net/wiki/x/AfIFKgE",
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -196,10 +196,10 @@ func TestEncodeTinyLinkIDMatchesPerl(t *testing.T) {
|
|||||||
func TestEncodeTinyLinkIDLargeIDs(t *testing.T) {
|
func TestEncodeTinyLinkIDLargeIDs(t *testing.T) {
|
||||||
// Test large page IDs (> 32-bit) which are common in Confluence Cloud
|
// Test large page IDs (> 32-bit) which are common in Confluence Cloud
|
||||||
// These exceed Perl's pack("L") but our implementation handles them
|
// These exceed Perl's pack("L") but our implementation handles them
|
||||||
largeID := uint64(5645697027) // User's actual page ID from the issue
|
largeID := uint64(5000000001)
|
||||||
result := encodeTinyLinkID(largeID)
|
result := encodeTinyLinkID(largeID)
|
||||||
assert.NotEmpty(t, result)
|
assert.NotEmpty(t, result)
|
||||||
assert.Equal(t, "A4CCUAE", result)
|
assert.Equal(t, "AfIFKgE", result)
|
||||||
|
|
||||||
// Verify the result is a valid URL-safe base64-like string
|
// Verify the result is a valid URL-safe base64-like string
|
||||||
assert.Regexp(t, `^[A-Za-z0-9_-]+$`, result)
|
assert.Regexp(t, `^[A-Za-z0-9_-]+$`, result)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user