style(portal-data): conform tests to belly-button

This commit is contained in:
Sérgio Ramos 2017-05-26 12:03:00 +01:00
parent c327f9f1ef
commit 150a9e45ad

View File

@ -12,7 +12,7 @@ const internals = {
options: { name: 'test', db: { test: true } } options: { name: 'test', db: { test: true } }
}; };
describe('connect()', function() { describe('connect()', function () {
it('connects to the database', () => { it('connects to the database', () => {
const data = new PortalData(internals.options); const data = new PortalData(internals.options);
@ -21,7 +21,7 @@ describe('connect()', function() {
}); });
describe.skip('createDeployment()', () => { describe.skip('createDeployment()', () => {
it('creates a deployment record in the deployment table', done => { it('creates a deployment record in the deployment table', (done) => {
const data = new PortalData(internals.options); const data = new PortalData(internals.options);
const deployment = { const deployment = {
name: 'User Services', name: 'User Services',
@ -35,19 +35,19 @@ describe.skip('createDeployment()', () => {
.createDeployment({ .createDeployment({
deployment deployment
}) })
.then(deployment => { .then((deployment) => {
expect(deployment.id).to.exist(); expect(deployment.id).to.exist();
done(); done();
}); });
}) })
.catch(err => { .catch((err) => {
expect(err).to.not.exist(); expect(err).to.not.exist();
}); });
}); });
}); });
describe.skip('getDeployment()', () => { describe.skip('getDeployment()', () => {
it('will retrieve an existing deployment', done => { it('will retrieve an existing deployment', (done) => {
const data = new PortalData(internals.options); const data = new PortalData(internals.options);
data.connect().then(() => { data.connect().then(() => {
const deployment = { const deployment = {
@ -55,9 +55,9 @@ describe.skip('getDeployment()', () => {
datacenter: 'us-sw-1' datacenter: 'us-sw-1'
}; };
data.createDeployment(deployment).then(deployment => { data.createDeployment(deployment).then((deployment) => {
expect(deployment.id).to.exist(); expect(deployment.id).to.exist();
data.getDeployment(deployment.id).then(retrievedDeployment => { data.getDeployment(deployment.id).then((retrievedDeployment) => {
expect(deployment).to.equal(retrievedDeployment); expect(deployment).to.equal(retrievedDeployment);
done(); done();
}); });
@ -67,7 +67,7 @@ describe.skip('getDeployment()', () => {
}); });
describe.skip('updateService()', () => { describe.skip('updateService()', () => {
it('will update the services for an existing deployment', done => { it('will update the services for an existing deployment', (done) => {
const data = new PortalData(internals.options); const data = new PortalData(internals.options);
data.connect().then(() => { data.connect().then(() => {
const deployment = { const deployment = {
@ -88,9 +88,9 @@ describe.skip('updateService()', () => {
count: 1 count: 1
}; };
data.createDeployment(deployment).then(deployment => { data.createDeployment(deployment).then((deployment) => {
expect(deployment.id).to.exist(); expect(deployment.id).to.exist();
data.updateService(deployment.id, service).then(updatedService => { data.updateService(deployment.id, service).then((updatedService) => {
expect(updatedService).to.equal(service); expect(updatedService).to.equal(service);
done(); done();
}); });
@ -100,7 +100,7 @@ describe.skip('updateService()', () => {
}); });
describe.skip('deploymentChanges()', () => { describe.skip('deploymentChanges()', () => {
it('will execute the handler when a deployment service changes', done => { it('will execute the handler when a deployment service changes', (done) => {
const data = new PortalData(internals.options); const data = new PortalData(internals.options);
data.connect().then(() => { data.connect().then(() => {
const deployment = { const deployment = {
@ -149,9 +149,9 @@ describe.skip('deploymentChanges()', () => {
count: 3 count: 3
}; };
data.createDeployment(deployment).then(deployment => { data.createDeployment(deployment).then((deployment) => {
expect(deployment.id).to.exist(); expect(deployment.id).to.exist();
data.updateService(deployment.id, service1).then(updatedService1 => { data.updateService(deployment.id, service1).then((updatedService1) => {
expect(updatedService1).to.equal(service1); expect(updatedService1).to.equal(service1);
let executed = false; let executed = false;
@ -170,7 +170,7 @@ describe.skip('deploymentChanges()', () => {
.then(() => { .then(() => {
data data
.updateService(deployment.id, service2) .updateService(deployment.id, service2)
.then(updatedService2 => { .then((updatedService2) => {
expect(updatedService2).to.equal(service2); expect(updatedService2).to.equal(service2);
}); });
}); });
@ -181,7 +181,7 @@ describe.skip('deploymentChanges()', () => {
}); });
describe.skip('insertMetrics()', () => { describe.skip('insertMetrics()', () => {
it("will add new metrics to a service and won't overwrite existing ones", done => { it("will add new metrics to a service and won't overwrite existing ones", (done) => {
const data = new PortalData(internals.options); const data = new PortalData(internals.options);
data.connect().then(() => { data.connect().then(() => {
const containerId = '81205d4a-92f4-c4d9-da8a-aafd689eeabb'; const containerId = '81205d4a-92f4-c4d9-da8a-aafd689eeabb';
@ -203,12 +203,12 @@ describe.skip('insertMetrics()', () => {
} }
]; ];
data.insertMetrics(containerId, metrics1).then(result1 => { data.insertMetrics(containerId, metrics1).then((result1) => {
expect(result1.id).to.equal(containerId); expect(result1.id).to.equal(containerId);
expect(result1.metrics).to.equal(metrics1); expect(result1.metrics).to.equal(metrics1);
data.insertMetrics(containerId, metrics2).then(result2 => { data.insertMetrics(containerId, metrics2).then((result2) => {
expect(result2.id).to.equal(containerId); expect(result2.id).to.equal(containerId);
data.getMetrics(containerId).then(results => { data.getMetrics(containerId).then((results) => {
expect(results.metrics.length).to.equal(2); expect(results.metrics.length).to.equal(2);
done(); done();
}); });