Skip to content

Question: testing validation with resources #6

@bassettsj

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.
    });
  });

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