Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the getChecklist functionality #79

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ API calls can either execute a callback or return a promise. To return a promise
* getCardsOnListWithExtraParams
* getCardStickers
* getChecklistsOnCard
* getChecklist
* getLabelsForBoard
* getListsOnBoard
* getListsOnBoardByFilter
Expand Down
4 changes: 4 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ Trello.prototype.addChecklistToCard = function (cardId, name, callback) {
return makeRequest(rest.post, this.uri + '/1/cards/' + cardId + '/checklists', { query: query }, callback);
};

Trello.prototype.getChecklist = function (checkListId, callback) {
return makeRequest(rest.get, this.uri + '/1/checklists/' + checkListId, {query: this.createQuery()}, callback);
};

Trello.prototype.addExistingChecklistToCard = function (cardId, checklistId, callback) {
var query = this.createQuery();
query.idChecklistSource = checklistId;
Expand Down
20 changes: 10 additions & 10 deletions test/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,32 +898,32 @@ describe('Trello', function () {
});
});

describe('getChecklistsOnCard', function() {
describe('getChecklist', function() {
var get;

beforeEach(function (done) {
sinon.stub(restler, 'get', function (uri, options) {
return {once: function (event, callback) {
callback(null, null);
}};
});
});

trello.getChecklistsOnCard('cardId', function () {
get = restler.get;
done();
});
trello.getChecklist('checkListId', function () {
get = restler.get;
done();
});
});

it('should get to https://api.trello.com/1/cards/cardId/checklists', function () {
get.should.have.been.calledWith('https://api.trello.com/1/cards/cardId/checklists');
it('should get to https://api.trello.com/1/checklists', function () {
get.should.have.been.calledWith('https://api.trello.com/1/checklists/checkListId');
});

afterEach(function () {
restler.get.restore();
});
});
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't remove tests for functionality that is still available.


describe('getBoardMembers', function() {
describe('getBoardMembers', function() {
var get;

beforeEach(function (done) {
Expand Down