@@ -68,63 +68,63 @@ func BenchmarkGenJobID(b *testing.B) {
6868}
6969
7070func TestConvertJobs_SkipNoStartedAt (t * testing.T ) {
71- job := & models.GithubJob {
72- ID : 123 ,
73- RunID : 456 ,
74- Name : "test-job" ,
75- StartedAt : nil ,
76- }
77-
78- convert := func (inputRow interface {}) ([]interface {}, error ) {
79- line := inputRow .(* models.GithubJob )
80- if line .StartedAt == nil {
81- return nil , nil
82- }
83- createdAt := * line .StartedAt
84- domainJob := & devops.CICDTask {
85- Name : line .Name ,
86- TaskDatesInfo : devops.TaskDatesInfo {
87- CreatedDate : createdAt ,
88- StartedDate : line .StartedAt ,
89- FinishedDate : line .CompletedAt ,
90- },
91- }
92- return []interface {}{domainJob }, nil
93- }
94-
95- result , err := convert (job )
96- assert .Nil (t , err )
97- assert .Nil (t , result )
71+ job := & models.GithubJob {
72+ ID : 123 ,
73+ RunID : 456 ,
74+ Name : "test-job" ,
75+ StartedAt : nil ,
76+ }
77+
78+ convert := func (inputRow interface {}) ([]interface {}, error ) {
79+ line := inputRow .(* models.GithubJob )
80+ if line .StartedAt == nil {
81+ return nil , nil
82+ }
83+ createdAt := * line .StartedAt
84+ domainJob := & devops.CICDTask {
85+ Name : line .Name ,
86+ TaskDatesInfo : devops.TaskDatesInfo {
87+ CreatedDate : createdAt ,
88+ StartedDate : line .StartedAt ,
89+ FinishedDate : line .CompletedAt ,
90+ },
91+ }
92+ return []interface {}{domainJob }, nil
93+ }
94+
95+ result , err := convert (job )
96+ assert .Nil (t , err )
97+ assert .Nil (t , result )
9898}
9999
100100func TestConvertJobs_WithStartedAt (t * testing.T ) {
101- now := time .Now ()
102- job := & models.GithubJob {
103- ID : 123 ,
104- RunID : 456 ,
105- Name : "test-job" ,
106- StartedAt : & now ,
107- }
108-
109- convert := func (inputRow interface {}) ([]interface {}, error ) {
110- line := inputRow .(* models.GithubJob )
111- if line .StartedAt == nil {
112- return nil , nil
113- }
114- createdAt := * line .StartedAt
115- domainJob := & devops.CICDTask {
116- Name : line .Name ,
117- TaskDatesInfo : devops.TaskDatesInfo {
118- CreatedDate : createdAt ,
119- StartedDate : line .StartedAt ,
120- FinishedDate : line .CompletedAt ,
121- },
122- }
123- return []interface {}{domainJob }, nil
124- }
125-
126- result , err := convert (job )
127- assert .Nil (t , err )
128- assert .NotNil (t , result )
129- assert .Equal (t , "test-job" , result [0 ].(* devops.CICDTask ).Name )
101+ now := time .Now ()
102+ job := & models.GithubJob {
103+ ID : 123 ,
104+ RunID : 456 ,
105+ Name : "test-job" ,
106+ StartedAt : & now ,
107+ }
108+
109+ convert := func (inputRow interface {}) ([]interface {}, error ) {
110+ line := inputRow .(* models.GithubJob )
111+ if line .StartedAt == nil {
112+ return nil , nil
113+ }
114+ createdAt := * line .StartedAt
115+ domainJob := & devops.CICDTask {
116+ Name : line .Name ,
117+ TaskDatesInfo : devops.TaskDatesInfo {
118+ CreatedDate : createdAt ,
119+ StartedDate : line .StartedAt ,
120+ FinishedDate : line .CompletedAt ,
121+ },
122+ }
123+ return []interface {}{domainJob }, nil
124+ }
125+
126+ result , err := convert (job )
127+ assert .Nil (t , err )
128+ assert .NotNil (t , result )
129+ assert .Equal (t , "test-job" , result [0 ].(* devops.CICDTask ).Name )
130130}
0 commit comments