Skip to content

Commit

Permalink
fix(options): Stop validating values for logLevel, pactFileWriteMode …
Browse files Browse the repository at this point in the history
…and format. This means we'll immediately pick up changes to those options without needing to modify pact-node
  • Loading branch information
TimothyJones committed May 4, 2020
1 parent 30364fd commit 1319a86
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 44 deletions.
5 changes: 0 additions & 5 deletions src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ export class Message {
checkTypes.assert.string(options.provider);
}

checkTypes.assert.includes(
['overwrite', 'update', 'merge'],
options.pactFileWriteMode,
);

this.options = options;
}

Expand Down
18 changes: 0 additions & 18 deletions src/server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,6 @@ describe('Server Spec', () => {
}),
).to.throw(Error);
});

it('should fail if incorrect pactFileWriteMode provided', () => {
expect(() =>
serverFactory({
pactFileWriteMode: 'notarealoption',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any),
).to.throw(Error);
});

it('should fail if incorrect logLevel provided', () => {
expect(() =>
serverFactory({
logLevel: 'nolog',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any),
).to.throw(Error);
});
});

context('when valid options are set', () => {
Expand Down
9 changes: 0 additions & 9 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,8 @@ export class Server extends AbstractService {
checkTypes.assert.string(options.provider);
}

checkTypes.assert.includes(
['overwrite', 'update', 'merge'],
options.pactFileWriteMode,
);

if (options.logLevel) {
options.logLevel = options.logLevel.toLowerCase() as LogLevel;
checkTypes.assert.includes(
['debug', 'info', 'warn', 'error'],
options.logLevel,
);
}

if (options.monkeypatch) {
Expand Down
11 changes: 0 additions & 11 deletions src/verifier.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,6 @@ describe('Verifier Spec', () => {
).to.throw(Error);
});

it('should throw an error with the wrong string', () => {
expect(() =>
verifierFactory({
providerBaseUrl: 'http://localhost',
pactUrls: ['http://idontexist'],
format: 'jsonformat',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any),
).to.throw(Error);
});

it('should work with a case insensitive string', () => {
expect(() =>
verifierFactory({
Expand Down
1 change: 0 additions & 1 deletion src/verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ export class Verifier {

if (options.format) {
checkTypes.assert.string(options.format);
checkTypes.assert.match(options.format, /^(xml|json|progress)$/i);
if (options.format.toLowerCase() === 'xml') {
options.format = 'RspecJunitFormatter';
}
Expand Down

0 comments on commit 1319a86

Please sign in to comment.