Last active
December 10, 2015 23:10
-
-
Save yamikuronue/60dcf7c366d99061536c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should update a board on PUT', (done) => { | |
dao.addBoard({ | |
ID: '1111', | |
Name: 'test board', | |
Adult: false, | |
BoardMasters: null, | |
Tags: [], | |
IC: null | |
}).then((data) => { | |
const formData = { | |
Name: 'test board edited!', | |
Adult: false, | |
BoardMasters: null, | |
Tags: [], | |
IC: null | |
}; | |
const req = http.request({ | |
host: 'localhost', | |
port: '8080', | |
path: '/api/board/1111', | |
method: 'PUT', | |
headers: { | |
'Content-type': 'application/json' | |
} | |
}); | |
req.write(`${JSON.stringify(formData)}\n`); | |
req.end(); | |
req.on('response', (response) => { | |
assert.equal(200, response.statusCode, 'Status code should be 200 OK'); | |
done(); | |
}); | |
}).catch((err) => { | |
assert.fail("no error", "error", "Error occurred: " + err); | |
done(); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try this to see if the catch fires correctly?