Skip to content

Question: testing validation with resources #6

Description

@bassettsj

So I wanted to make sure the validations were working in the defined resources. What do you think a good test would be for that?

  it('validates data before creation', function () {
    var invalidEvnt = angular.extend(testEvnt, {
      startDate: false // must be a Date object and must be less than endDate.
    });
    // Have to return something here;
    DS.expectCreate('evnt', invalidEvnt).respond(new Error('invalid'));

    Evnt.create(invalidEvnt).then(function (result) {
      fail('should have rejected');
    }, function (err) {
       //This will just return the error I created, thus the test is a little useless.
    });
  });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions