z_ui_board_01_filetest.gno
1.85 Kb · 51 lines
1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_ui_board_01_filetest
2
3// Render board sorting threads from newest to oldest.
4package z_ui_board_01_filetest
5
6import (
7 "testing"
8
9 boards2 "gno.land/r/gnoland/boards2/v1"
10)
11
12const (
13 owner address = "g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"
14 boardName = "TestBoard"
15)
16
17func init(cur realm) {
18 testing.SetRealm(testing.NewUserRealm(owner))
19
20 // Create a board and then add 3 threads
21 boardID := boards2.CreateBoard(cross(cur), boardName, false, false)
22
23 boards2.CreateThread(cross(cur), boardID, "A", "Body")
24 boards2.CreateThread(cross(cur), boardID, "B", "Body")
25 boards2.CreateThread(cross(cur), boardID, "C", "Body")
26}
27
28func main() {
29 path := boardName + "?order=desc"
30 println(boards2.Render(path))
31}
32
33// Output:
34// # [Boards](/r/gnoland/boards2/v1) › TestBoard
35// Created by [g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh](/u/g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh) on 2009-02-13 11:31pm UTC, #1
36// ↳ [Create Thread](/r/gnoland/boards2/v1:TestBoard/create-thread) • [Request Invite](/r/gnoland/boards2/v1$help&func=RequestInvite&boardID=1) • [Manage Board](?menu=manageBoard)
37//
38// ---
39// Sort by: [oldest first](/r/gnoland/boards2/v1:TestBoard?order=asc)
40//
41// ###### [C](/r/gnoland/boards2/v1:TestBoard/3)
42// Created by [g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh](/u/g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh) `owner` on 2009-02-13 11:31pm UTC
43// **0 replies • 0 reposts**
44//
45// ###### [B](/r/gnoland/boards2/v1:TestBoard/2)
46// Created by [g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh](/u/g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh) `owner` on 2009-02-13 11:31pm UTC
47// **0 replies • 0 reposts**
48//
49// ###### [A](/r/gnoland/boards2/v1:TestBoard/1)
50// Created by [g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh](/u/g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh) `owner` on 2009-02-13 11:31pm UTC
51// **0 replies • 0 reposts**