// TestCreatedAtMustBeNumber tests that created_at value type must be a number func TestCreatedAtMustBeNumber(t *testing.T) { d := map[string]interface{}{ "id": util.Sha1("abcd"), "type": "coupon", "created_at": "111", } err := ValidateMetaBlock(d) assert.NotNil(t, err) expectedMsg := "`meta.created_at` value type is invalid. Expects a number" assert.Equal(t, expectedMsg, err.Error()) }
// TestCreatedAtBeforeStartTime test that a created_at time before the start/launch time is invalid func TestCreatedAtBeforeStartTime(t *testing.T) { d := map[string]interface{}{ "id": util.Sha1("abcd"), "type": "coupon", "created_at": 100000, } err := ValidateMetaBlock(d) assert.NotNil(t, err) expectedMsg := "`meta.created_at` value is too far in the past. Expects unix time on or after 2016-01-28T11:06:15+01:00" assert.Equal(t, expectedMsg, err.Error()) }
// TestStoneTypeMustBeString tests that type value type must be string func TestStoneTypeMustBeString(t *testing.T) { d := map[string]interface{}{ "id": util.Sha1("abcd"), "type": 123, "created_at": 1000, } err := ValidateMetaBlock(d) assert.NotNil(t, err) expectedMsg := "`meta.type` value type is invalid. Expects a string" assert.Equal(t, expectedMsg, err.Error()) }