Skip to content

Commit

Permalink
Testing updates
Browse files Browse the repository at this point in the history
  • Loading branch information
byronhulcher committed Jun 27, 2016
1 parent c2a4c17 commit 60bc14b
Showing 1 changed file with 10 additions and 28 deletions.
38 changes: 10 additions & 28 deletions lib/services/pages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ describe(_.startCase(filename), function () {
return fn('domain.com/path/pages/thing@published', {layout: 'domain.com/path/components/thing'},
{
site: {
resolvePublishing: () => [
() => function (uri, data) { data.url = 'http://some-domain.com'; return data; }
]
resolvePublishing: () => [ function (uri, data) { data.url = 'http://some-domain.com'; return data; } ]
}
}).then(function () {
const ops = db.batch.args[0][0],
Expand All @@ -159,9 +157,7 @@ describe(_.startCase(filename), function () {
return fn('domain.com/path/pages/thing@published', {layout: 'domain.com/path/components/thing'},
{
site: {
resolvePublishing: () => [
() => function (uri, data) { data.url = 'http://some-domain.com'; return data; }
]
resolvePublishing: () => [ function (uri, data) { data.url = 'http://some-domain.com'; return data; } ]
}
}).then(function () {
sinon.assert.calledWith(winston.log, 'warn', sinon.match('slow publish domain.com/path/pages/thing@published 700ms'));
Expand All @@ -180,9 +176,7 @@ describe(_.startCase(filename), function () {
return fn(uri, {layout: 'domain.com/path/components/thing'},
{
site: {
resolvePublishing: () => [
() => function (uri, data) { data.url = 'http://some-domain.com'; return data; }
]
resolvePublishing: () => [ function (uri, data) { data.url = 'http://some-domain.com'; return data; } ]
}
}).then(function () {
sinon.assert.calledWith(winston.log, 'warn');
Expand All @@ -192,9 +186,7 @@ describe(_.startCase(filename), function () {

it('notifies', function () {
const site = {
resolvePublishing: () => [
() => function (uri, data) { data.url = 'http://some-domain.com'; return data; }
]
resolvePublishing: () => [ function (uri, data) { data.url = 'http://some-domain.com'; return data; } ]
},
uri = 'domain.com/path/pages/thing@published';

Expand All @@ -216,10 +208,8 @@ describe(_.startCase(filename), function () {
db.batch.returns(bluebird.resolve());
siteService.getSiteFromPrefix.returns({notify: _.noop});

fn('domain.com/path/pages/thing@published', {layout: 'domain.com/path/components/thing', head: ['']},
{
site: {}
}).then(done)
fn('domain.com/path/pages/thing@published', {layout: 'domain.com/path/components/thing', head: ['']}, { site: {} })
.then(done)
.catch(function (result) {
expect(result.message).to.equal('Client: page cannot have empty values');
done();
Expand All @@ -235,9 +225,7 @@ describe(_.startCase(filename), function () {
return fn('domain.com/path/pages/thing@published', {layout: 'domain.com/path/components/thing'},
{
site: {
resolvePublishing: () => [
() => function (uri, data) { data.url = 'http://some-domain.com'; return data; }
]
resolvePublishing: () => [ function (uri, data) { data.url = 'http://some-domain.com'; return data; } ]
}
}).then(function (result) {
expect(result.layout).to.equal('domain.com/path/components/thing@published');
Expand All @@ -253,9 +241,7 @@ describe(_.startCase(filename), function () {

return fn('domain.com/path/pages/thing@published', {}, {
site: {
resolvePublishing: () => [
() => function (uri, data) { data.url = 'http://some-domain.com'; return data; }
]
resolvePublishing: () => [ function (uri, data) { data.url = 'http://some-domain.com'; return data; } ]
}
}).then(function (result) {
expect(result).to.deep.equal({layout: 'domain.com/path/components/thing@published', url: 'http://some-domain.com'});
Expand All @@ -271,9 +257,7 @@ describe(_.startCase(filename), function () {
fn('domain.com/path/pages/thing@published', {layout: 'domain.com/path/components/thing'},
{
site: {
resolvePublishing: () => [
() => function (uri, data) { return data; }
]
resolvePublishing: () => [ function (uri, data) { return data; } ]
}
}).then(done)
.catch(function (result) {
Expand All @@ -291,9 +275,7 @@ describe(_.startCase(filename), function () {
fn('domain.com/path/pages/thing@published', {layout: 'domain.com/path/components/thing'},
{
site: {
resolvePublishing: () => [
() => function () { throw new Error('url error'); }
]
resolvePublishing: () => [ function () { return bluebird.reject(new Error('url error')); } ]
}
}).then(done)
.catch(function (result) {
Expand Down

0 comments on commit 60bc14b

Please sign in to comment.