Skip to content

Commit

Permalink
feat(r/demo/users): pre-register test1 user to make interaction with …
Browse files Browse the repository at this point in the history
…boards easier (#2823)

Fixes #990. 

<details><summary>Contributors' checklist...</summary>

- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>
  • Loading branch information
hthieu1110 authored Sep 26, 2024
1 parent a58bb00 commit 0bfa8ff
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/users/gno.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ module gno.land/r/demo/users
require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/avlhelpers v0.0.0-latest
gno.land/p/demo/uassert v0.0.0-latest
gno.land/p/demo/users v0.0.0-latest
)
3 changes: 3 additions & 0 deletions examples/gno.land/r/demo/users/preregister.gno
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ var preRegisteredUsers = []struct {
{"nt", "g15ge0ae9077eh40erwrn2eq0xw6wupwqthpv34l"}, // -> @r_nt
{"sys", "g1r929wt2qplfawe4lvqv9zuwfdcz4vxdun7qh8l"}, // -> @r_sys
{"x", "g164sdpew3c2t3rvxj3kmfv7c7ujlvcw2punzzuz"}, // -> @r_x

// test1 user
{"test1", "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5"}, // -> @test1
}

func init() {
Expand Down
13 changes: 13 additions & 0 deletions examples/gno.land/r/demo/users/users_test.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package users

import (
"testing"

"gno.land/p/demo/uassert"
)

func TestPreRegisteredTest1(t *testing.T) {
names := ListUsersByPrefix("test1", 1)
uassert.Equal(t, len(names), 1)
uassert.Equal(t, names[0], "test1")
}
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/users/z_5_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func main() {
// * [nt](/r/demo/users:nt)
// * [satoshi](/r/demo/users:satoshi)
// * [sys](/r/demo/users:sys)
// * [test1](/r/demo/users:test1)
// * [x](/r/demo/users:x)
//
// ========================================
Expand Down

0 comments on commit 0bfa8ff

Please sign in to comment.