github.com/condensat/bank-core@v0.1.0/database/model/batch_test.go (about) 1 // Copyright 2020 Condensat Tech. All rights reserved. 2 // Use of this source code is governed by a MIT 3 // license that can be found in the LICENSE file. 4 5 package model 6 7 import ( 8 "testing" 9 "time" 10 ) 11 12 func TestBatch_IsComplete(t *testing.T) { 13 type fields struct { 14 ExecuteAfter time.Time 15 } 16 tests := []struct { 17 name string 18 fields fields 19 want bool 20 }{ 21 {"default", fields{}, true}, 22 23 {"not_complete", fields{time.Now().Add(time.Minute)}, false}, 24 {"now", fields{time.Now()}, true}, 25 {"complete", fields{time.Now().Add(-time.Minute)}, true}, 26 } 27 for _, tt := range tests { 28 t.Run(tt.name, func(t *testing.T) { 29 p := &Batch{ 30 ExecuteAfter: tt.fields.ExecuteAfter, 31 } 32 if got := p.IsComplete(); got != tt.want { 33 t.Errorf("Batch.IsComplete() = %v, want %v", got, tt.want) 34 } 35 }) 36 } 37 }