status-desktop/test/nim/utils_test.nim
Godfrain Jacques ab61784816
(fix/desktop) removing custom picture is not reflected on contact's side (#13197)
* chore: bump status-go

* (fix/desktop) removing custom picture is not reflected on contact's side

This PR fixes [9947](#9947) and contains :

- Commit to fix the changing of custom picture and having the change
  reflected on contact's side
- Commit to fix the deleting of picture and having the change reflected
  on contact's side
2024-01-26 07:54:30 -08:00

28 lines
1.0 KiB
Nim

import unittest, strutils
import app/global/utils/time_utils
suite "adding timestamp to url":
test "adding timestamp to an image url with query containing ?":
let url = "https://Localhost:35651/contactImages?imageName=thumbnail?publicKey=0x04d76f84ec"
let result = time_utils.addTimestampToURL(url)
check(result.startsWith(url & "&timestamp="))
test "adding timestamp to an image url with query containing &":
let url = "https://Localhost:35651/contactImages&imageName=thumbnail&publicKey=0x04d76f84e8dc"
let result = time_utils.addTimestampToURL(url)
check(result.startsWith(url & "?timestamp="))
test "image contains a mix of & and ? queries, & is added":
let url = "https://Localhost:35651/contactImages?imageName=thumbnail&publicKey=0x04d76f84e8dc"
let result = time_utils.addTimestampToURL(url)
check(result.startsWith(url & "&timestamp="))
test "adding timestamp to an empty image url":
let result = time_utils.addTimestampToURL("")
let expectedResult = ""
check(result == expectedResult)