github.com/Ali-iotechsys/sqlboiler/v4@v4.0.0-20221208124957-6aec9a5f1f71/boil/hooks_test.go (about)

     1  package boil
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  )
     7  
     8  func TestSkipHooks(t *testing.T) {
     9  	t.Parallel()
    10  
    11  	ctx := context.Background()
    12  	if HooksAreSkipped(ctx) {
    13  		t.Error("they should not be skipped")
    14  	}
    15  
    16  	ctx = SkipHooks(ctx)
    17  
    18  	if !HooksAreSkipped(ctx) {
    19  		t.Error("they should be skipped")
    20  	}
    21  }
    22  
    23  func TestSkipTimestamps(t *testing.T) {
    24  	t.Parallel()
    25  
    26  	ctx := context.Background()
    27  	if TimestampsAreSkipped(ctx) {
    28  		t.Error("they should not be skipped")
    29  	}
    30  
    31  	ctx = SkipTimestamps(ctx)
    32  
    33  	if !TimestampsAreSkipped(ctx) {
    34  		t.Error("they should be skipped")
    35  	}
    36  }