Skip to content

Commit

Permalink
"Better remove 'detected' in the properties name."
Browse files Browse the repository at this point in the history
  • Loading branch information
tripu committed Mar 22, 2016
1 parent d504d84 commit ca80fbb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ This method returns a simple object with metadata inferred from the document.
The `options` accepted are equal to those in `validate()`, except that a `profile` is not necessary and will be ignored (finding out the profile is one of the
goals of this method).

The returned `Object` may contain up to 2 properties: `detectedProfile` and `detectedDelivererIDs`.
The returned `Object` may contain up to 2 properties: `profile` and `delivererIDs`.
If some of these pieces of metadata cannot be deduced, that key will not exist, or its value will not be defined.

An example:

```json
{
"detectedProfile": "WD",
"detectedDelivererIDs": [47318, 43696]
"profile": "WD",
"delivererIDs": [47318, 43696]
}
```

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/metadata/deliverers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ exports.check = function(sr, done) {

}

done({detectedDelivererIDs: ids});
done({delivererIDs: ids});

};
2 changes: 1 addition & 1 deletion lib/rules/metadata/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ exports.check = function(sr, done) {
}
});
if (id) {
done({detectedProfile: id});
done({profile: id});
}
else {
done();
Expand Down
6 changes: 3 additions & 3 deletions test/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const compareMetadata = function(url, file, type, expectedValue) {
if (META_PROFILE === type) {
it('Should detect a ' + expectedValue, function (done) {
handler.on('end-all', function () {
chai(specberus).to.have.property('meta').to.have.property('detectedProfile').equal(expectedValue);
chai(specberus).to.have.property('meta').to.have.property('profile').equal(expectedValue);
done();
});
specberus.extractMetadata(opts);
Expand All @@ -77,8 +77,8 @@ const compareMetadata = function(url, file, type, expectedValue) {
else if (META_DELIVERER_IDS === type) {
it('Should find deliverer IDs of ' + (url ? url : file), function (done) {
handler.on('end-all', function () {
chai(specberus).to.have.property('meta').to.have.property('detectedDelivererIDs');
chai(specberus.meta.detectedDelivererIDs).to.satisfy(function(found) {
chai(specberus).to.have.property('meta').to.have.property('delivererIDs');
chai(specberus.meta.delivererIDs).to.satisfy(function(found) {
return equivalentDelivererIDs(found, expectedValue);
});
done();
Expand Down

0 comments on commit ca80fbb

Please sign in to comment.