Skip to content

Instantly share code, notes, and snippets.

@chilts
Created March 20, 2014 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chilts/9676306 to your computer and use it in GitHub Desktop.
Save chilts/9676306 to your computer and use it in GitHub Desktop.
return Client.create(config.publicUrl, 'a+b+c@example.com', pwd)
.then(
function (c) {
return c.destroyAccount()
},
function (err) {
t.equal(err.errno, 101, 'unusual email is not invalid')
}
)
// should be
return Client.create(config.publicUrl, 'a+b+c@example.com', pwd)
.then(
function (c) {
t.pass('Weird but valid email address accepted')
return c.destroyAccount()
},
function (err) {
t.fail('Email address ' + email + ' is valid, but was not accepted')
}
)
@dannycoates
Copy link

We don't care whether the create succeeds or not, we only care that we don't get a validation error. The top one is close to correct, but should really check that errno != 107, but since a 101 means it passed validation its not wrong. The test should not fail in the bottom one unless the errno == 107, but besides that it is ok too.

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