File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 11package generator
22
33import (
4- "github.com/brianvoe/gofakeit/v6"
54 "mokapi/schema/json/schema"
65 "time"
6+
7+ "github.com/brianvoe/gofakeit/v6"
78)
89
910var (
@@ -73,6 +74,8 @@ func fakeFormat(s *schema.Schema) (interface{}, error) {
7374 return date ().Format ("2006-01-02" ), nil
7475 case "date-time" :
7576 return date ().Format (time .RFC3339 ), nil
77+ case "time" :
78+ return date ().Format ("15:04:05Z07:00" ), nil
7679 case "password" :
7780 return gofakeit .Generate ("{password}" ), nil
7881 case "email" :
Original file line number Diff line number Diff line change 11package generator
22
33import (
4- "github.com/brianvoe/gofakeit/v6"
5- "github.com/stretchr/testify/require"
64 "mokapi/schema/json/schema/schematest"
75 "testing"
6+
7+ "github.com/brianvoe/gofakeit/v6"
8+ "github.com/stretchr/testify/require"
89)
910
1011func TestStringFormat (t * testing.T ) {
@@ -33,6 +34,16 @@ func TestStringFormat(t *testing.T) {
3334 require .Equal (t , "2007-08-26T07:02:11Z" , v )
3435 },
3536 },
37+ {
38+ name : "time" ,
39+ req : & Request {
40+ Schema : schematest .New ("string" , schematest .WithFormat ("time" )),
41+ },
42+ test : func (t * testing.T , v interface {}, err error ) {
43+ require .NoError (t , err )
44+ require .Equal (t , "07:02:11Z" , v )
45+ },
46+ },
3647 {
3748 name : "password" ,
3849 req : & Request {
You can’t perform that action at this time.
0 commit comments