pa11y-webservice-client-node
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -38,2 +38,7 @@ 'use strict'; | ||
// Edit a task | ||
edit: function (edits, done) { | ||
patch(root + 'tasks/' + id, edits, done); | ||
}, | ||
// Remove a task | ||
@@ -81,2 +86,7 @@ remove: function (done) { | ||
// Perform a PATCH request | ||
function patch (url, body, done) { | ||
req('PATCH', url, null, body, done); | ||
} | ||
// Perform a POST request | ||
@@ -83,0 +93,0 @@ function post (url, body, done) { |
{ | ||
"name": "pa11y-webservice-client-node", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
@@ -5,0 +5,0 @@ "description": "pa11y-webservice-client-node is a Node.js client library for pa11y-webservice", |
@@ -7,3 +7,4 @@ | ||
**Current Version:** *1.0.0* | ||
**Current Version:** *1.1.0* | ||
**Build Status:** [![Build Status][travis-img]][travis] | ||
**Node Version Support:** *0.10* | ||
@@ -158,2 +159,4 @@ | ||
[pa11y-webservice]: https://github.com/nature/pa11y-webservice | ||
[travis]: https://travis-ci.org/nature/pa11y-webservice-client-node | ||
[travis-img]: https://travis-ci.org/nature/pa11y-webservice-client-node.png?branch=master | ||
[wiki-web-service]: https://github.com/nature/pa11y-webservice/wiki/Web-Service-Endpoints |
@@ -56,2 +56,6 @@ 'use strict'; | ||
'PATCH http://pa11y-ws/tasks/task1': function (query, body, done) { | ||
return done(null, {statusCode: 204}, mockTask); | ||
}, | ||
'DELETE http://pa11y-ws/tasks/task1': function (query, body, done) { | ||
@@ -58,0 +62,0 @@ return done(null, {statusCode: 204}, null); |
@@ -185,2 +185,6 @@ /* global afterEach, beforeEach, describe, it */ | ||
it('should have an edit method', function () { | ||
assert.isFunction(client.task().edit); | ||
}); | ||
it('should have a remove method', function () { | ||
@@ -239,2 +243,22 @@ assert.isFunction(client.task().remove); | ||
describe('.edit()', function () { | ||
it('should edit the task in the web-service', function (done) { | ||
client.task('task1').edit({}, function (err, task) { | ||
assert.isObject(task); | ||
assert.isDefined(task.id); | ||
done(); | ||
}); | ||
}); | ||
it('should callback with an error if the task was not found', function (done) { | ||
client.task('task2').edit({}, function (err) { | ||
assert.isInstanceOf(err, Error); | ||
assert.strictEqual(err.message, 'foo'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('.remove()', function () { | ||
@@ -241,0 +265,0 @@ |
56507
10
529
161