Skip to content

Commit

Permalink
fix: remove format form getRule rule name
Browse files Browse the repository at this point in the history
  • Loading branch information
casserni committed Dec 3, 2018
1 parent 16e5992 commit 2dec3bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/__tests__/spectral.test.ts
Expand Up @@ -12,7 +12,7 @@ describe('spectral', () => {
});

const results = s.run({ target: todosPartialDeref, spec: 'oas2' });
expect(results.length).toBeGreaterThan(0);
expect(results.length).toBe(0);
});

// Assures: https://stoplightio.atlassian.net/browse/SL-786
Expand Down Expand Up @@ -92,7 +92,7 @@ Array [
Object {
"apply": [Function],
"format": "oas2",
"name": "oas2-ruleName1",
"name": "ruleName1",
"rule": Object {
"enabled": true,
"function": "truthy",
Expand All @@ -111,7 +111,7 @@ Array [
Object {
"apply": [Function],
"format": "oas3",
"name": "oas3-ruleName1",
"name": "ruleName1",
"rule": Object {
"enabled": false,
"function": "notContain",
Expand Down Expand Up @@ -224,6 +224,6 @@ Array [
const s = new Spectral({ rulesets });
const results = s.getRules('oas2');

expect(results.length).toBe(2);
expect(results.length).toBe(1);
});
});
4 changes: 2 additions & 2 deletions src/index.ts
Expand Up @@ -79,10 +79,10 @@ export class Spectral {

for (const name in this._rulesByIndex) {
if (!this._rulesByIndex.hasOwnProperty(name)) continue;
const { rule, format, apply } = this._rulesByIndex[name];
const { name: rName, rule, format, apply } = this._rulesByIndex[name];

if (!dataFormat || format === dataFormat) {
rules.push({ name, format, rule, apply });
rules.push({ name: rName, format, rule, apply });
}
}

Expand Down

0 comments on commit 2dec3bb

Please sign in to comment.