package migration

import "testing"

func TestConfigureImportBatch(t *testing.T) {
	t.Cleanup(func() {
		ConfigureImportBatch(ImportBatchConfig{
			Mail:  defaultMailImportBatchSize,
			Drive: defaultDriveImportBatchSize,
		})
	})

	ConfigureImportBatch(ImportBatchConfig{Mail: 7, Drive: 3})
	if got := mailImportBatchSize(); got != 7 {
		t.Fatalf("mail batch = %d", got)
	}
	if got := driveImportBatchSize(); got != 3 {
		t.Fatalf("drive batch = %d", got)
	}

	ConfigureImportBatch(ImportBatchConfig{Mail: 0, Drive: 0})
	if got := mailImportBatchSize(); got != 7 {
		t.Fatalf("mail batch unchanged = %d", got)
	}
}
