Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
test: removes "isValidatable" test suites
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-zakharchenko committed May 30, 2019
1 parent 22b5053 commit 3d3a2a3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 105 deletions.
29 changes: 0 additions & 29 deletions test/unit/mixins/validatable-http-message-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const fixtures = require('../../fixtures');
describe('Http validatable mixin', () => {
describe('when mixed in any HTTP Message class', () => {
const methods = [
'isValidatable',
'validate',
'isValid',
'validationResults',
Expand Down Expand Up @@ -44,34 +43,6 @@ describe('Http validatable mixin', () => {
});
});

describe('#isValidatable()', () => {
describe('when no validatable HTTP component in the object', () => {
it('should return false', () => {
const instance = new HttpResponse({ foo: 'bar' });
assert.isFalse(instance.isValidatable());
});
});

describe('when any validatable HTTP component is present in the object', () => {
it('should return true for some headers', () => {
const instance = new HttpResponse({
headers: { 'content-type:': 'application/json' }
});
assert.isTrue(instance.isValidatable());
});

it('should return true for some body', () => {
const instance = new HttpResponse({ body: '' });
assert.isTrue(instance.isValidatable());
});

it('should return true for some statusCode', () => {
const instance = new HttpResponse({ statusCode: 200 });
assert.isTrue(instance.isValidatable());
});
});
});

describe('any HTTP Message instance', () => {
let instance = {};
let response = {
Expand Down
77 changes: 1 addition & 76 deletions test/unit/validate-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { assert } = require('chai');
const clone = require('clone');
const { validate, isValid, isValidatable } = require('../../lib/gavel');
const { validate, isValid } = require('../../lib/gavel');

describe('Gavel proxies to functions with callbacks', () => {
// Examples from README.md
Expand Down Expand Up @@ -42,81 +42,6 @@ describe('Gavel proxies to functions with callbacks', () => {
body: '{"origin":"1.2.3.4"}'
};

describe('isValidatable', () => {
describe('when I provide data from README (good objects)', () => {
['response', 'request'].forEach((variant) => {
describe(`for two cloned ${variant}s`, () => {
let results = null;
let error = null;

before((done) => {
isValidatable(
cloneHttpMessage,
baseHttpMessage,
variant,
(err, result) => {
error = err;
results = result;
done();
}
);
});

it('should call the callback without any errors', () =>
assert.isNull(error));
it('should be ok as a result of isValidatable', () =>
assert.isTrue(results));
});

describe('for similar #{variant}s', () => {
let results = null;
let error = null;

before((done) => {
isValidatable(
similarHttpMessage,
baseHttpMessage,
variant,
(err, result) => {
error = err;
results = result;
done();
}
);
});

it('should call the callback without any errors', () =>
assert.isNull(error));
it('should be ok as a result of isValidatable', () =>
assert.isTrue(results));
});

describe('for different #{variant}s', () => {
let results = null;
let error = null;

before((done) => {
isValidatable(
differentHttpMessage,
baseHttpMessage,
variant,
(err, result) => {
error = err;
results = result;
done();
}
);
});

it('should call the callback without any errors', () =>
assert.isNull(error));
it('should be ok as a result of isValidatable', () =>
assert.isTrue(results));
});
});
});
});

describe('isValid', () => {
describe('when I provide data', () => {
['response', 'request'].forEach((variant) => {
Expand Down

0 comments on commit 3d3a2a3

Please sign in to comment.