Skip to content

Commit

Permalink
Merge pull request #88 from dontcallmedom/bystatus
Browse files Browse the repository at this point in the history
Add support for fetching specifications by status
  • Loading branch information
deniak authored Jan 12, 2022
2 parents ba96cde + 5e361c5 commit 175b758
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,13 @@ Ctx.prototype.fetch = async function (options, cb) {
};

// generates a function for the root list
function rootList (type) {
return function () {
function rootList (type, linkKey) {
return function (name) {
var ctx = new Ctx();
ctx.type = "list";
ctx.linkKey = type;
ctx.linkKey = linkKey ? linkKey : type;
ctx.steps = [type];
if (!!name) ctx.steps.push(name);
return ctx;
};
}
Expand Down Expand Up @@ -319,3 +320,9 @@ function SeriesCtx (ctx) {
subSteps(SeriesCtx, ['specifications']);

exports.specificationseries = idStep(SeriesCtx, 'specification-series');

//------------------------------------- 12. Specifications by status

exports.specificationsByStatus = rootList('specifications-by-status', 'specifications');


9 changes: 9 additions & 0 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ describe('Call for translations', function () {
});
});


describe('Non-participant licensing commitments', function () {
it("can be fetched", function (done) {
w3c.nplcs().fetch(listChecker(done, 9252268, 'repoId'));
Expand All @@ -244,6 +245,14 @@ describe('Non-participant licensing commitments', function () {
});
});


describe('Specifications by status', function () {
it("can be listed", function (done) {
w3c.specificationsByStatus("Recommendation").fetch(listChecker(done, "Webmention"));
});
});


describe("Embeds", function () {
it('apply to functions', function (done) {
w3c.functions().fetch({ embed: true }, embedChecker(done, 'name', 'Management'));
Expand Down

0 comments on commit 175b758

Please sign in to comment.