The backend for the AiteStory website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
559 B

7 years ago
  1. package model
  2. import "testing"
  3. import "time"
  4. func TestPage(t *testing.T) {
  5. t.Run("BasicConstants", func(t *testing.T) {
  6. if PageMinDate.Format(time.RFC3339) != "1753-01-01T00:00:00Z" {
  7. t.Error("Invalid date:", PageMinDate.Format(time.RFC3339))
  8. t.Fail()
  9. }
  10. page := Page{}
  11. page.generateID()
  12. if len(page.ID) != 16 {
  13. t.Errorf("len(page.ID): %d != 16", len(page.ID))
  14. t.Fail()
  15. }
  16. id1 := page.ID
  17. page.generateID()
  18. id2 := page.ID
  19. t.Logf("Page IDs: %s, %s (should not be the same)", id1, id2)
  20. if id1 == id2 {
  21. t.Fail()
  22. }
  23. })
  24. }