forked from mtusi2026/mtusi2026lab5
25 lines
611 B
Go
25 lines
611 B
Go
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
)
|
|
|
|
type ModelSuite struct {
|
|
suite.Suite
|
|
}
|
|
|
|
func TestModelSuite(t *testing.T) {
|
|
suite.Run(t, new(ModelSuite))
|
|
}
|
|
|
|
func (s *ModelSuite) TestUserTimestampHasFixedMicroseconds() {
|
|
createdAt := time.Date(2026, time.September, 23, 21, 28, 15, 423030000, time.UTC)
|
|
data, err := json.Marshal(User{ID: "id", Username: "user", DisplayName: "User", CreatedAt: createdAt})
|
|
s.Require().NoError(err)
|
|
s.Equal(`{"id":"id","username":"user","display_name":"User","created_at":"2026-09-23T21:28:15.423030Z"}`, string(data))
|
|
}
|