github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/builtin/providers/aws/diff_suppress_funcs_test.go (about)

     1  package aws
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/helper/schema"
     7  )
     8  
     9  func TestSuppressEquivalentJsonDiffsWhitespaceAndNoWhitespace(t *testing.T) {
    10  	d := new(schema.ResourceData)
    11  
    12  	noWhitespace := `{"test":"test"}`
    13  	whitespace := `
    14  {
    15    "test": "test"
    16  }`
    17  
    18  	if !suppressEquivalentJsonDiffs("", noWhitespace, whitespace, d) {
    19  		t.Errorf("Expected suppressEquivalentJsonDiffs to return true for %s == %s", noWhitespace, whitespace)
    20  	}
    21  
    22  	noWhitespaceDiff := `{"test":"test"}`
    23  	whitespaceDiff := `
    24  {
    25    "test": "tested"
    26  }`
    27  
    28  	if suppressEquivalentJsonDiffs("", noWhitespaceDiff, whitespaceDiff, d) {
    29  		t.Errorf("Expected suppressEquivalentJsonDiffs to return false for %s == %s", noWhitespaceDiff, whitespaceDiff)
    30  	}
    31  }