Started write of tests

This commit is contained in:
Dan Seripap 2016-02-23 16:32:02 -05:00
parent 7816f2aa87
commit 0a29d92aed
5 changed files with 28 additions and 22 deletions

View File

@ -4,4 +4,4 @@ node_js:
before_script:
- gulp bundle
- sleep 5
script: gulp test
script: npm test

View File

@ -24,11 +24,6 @@ export default class Darkwire {
return file.data;
}
set fileQueue(fileQueue) {
this._fileQueue = fileQueue;
return this;
}
get autoEmbedImages() {
return this._autoEmbedImages;
}

View File

@ -27,7 +27,7 @@ class Room {
vector: data.vector,
secretKeys: data.secretKeys,
signature: data.signature,
timestamp: new Date
timestamp: new Date()
});
});
@ -48,7 +48,7 @@ class Room {
username: socket.username,
numUsers: this.numUsers,
users: this.users,
timestamp: new Date
timestamp: new Date()
});
});
@ -78,7 +78,7 @@ class Room {
numUsers: this.numUsers,
users: this.users,
id: socket.user.id,
timestamp: new Date
timestamp: new Date()
});
// remove room from rooms array
@ -111,7 +111,7 @@ class Room {
newUsername: data.newUsername,
publicKey: data.publicKey,
users: this.users,
timestamp: new Date
timestamp: new Date()
});
});
@ -119,7 +119,7 @@ class Room {
});
}
get roomId() {
roomId() {
return this.id;
}
}

View File

@ -68,7 +68,7 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">About</h4>
<p><strong>Darkwire Version:</strong> v{{APP.version}} (<a href="https://github.com/seripap/darkwire.io/releases/tag/v{{APP.version}}" target="_blank">View Release Notes</a>)<br></p>
<p><strong>Darkwire Version:</strong> <span id="appVersion">v{{APP.version}}</span> (<a href="https://github.com/seripap/darkwire.io/releases/tag/v{{APP.version}}" target="_blank">View Release Notes</a>)<br></p>
</div>
<div class="modal-body">
{{>partials/disclaimer}}

View File

@ -1,15 +1,18 @@
import appPkg from '../package.json';
import helpers from './helpers';
import app from '../index';
import mochaJSCS from 'mocha-jscs';
import mochaJSHint from 'mocha-jshint';
import Browser from 'zombie';
const APPVER = 'v' + appPkg.version;
const Browser = require('zombie');
Browser.localhost('localhost', 3000);
mochaJSCS();
mochaJSHint();
describe('Visiting /', () => {
describe('Darkwire', () => {
const browser = new Browser();
@ -22,19 +25,25 @@ describe('Visiting /', () => {
browser.visit('/', done);
});
describe('Navigate to /', () => {
it('should be running released version', () => {
browser.assert.text('#appVersion', APPVER);
});
it('should be successful', () => {
browser.assert.success();
});
it('should show welcome modal', () => {
browser.assert.evaluate('$("#first-modal:visible").length', 1);
browser.assert.text('#first-modal h4.modal-title', 'Welcome to darkwire.io');
browser.assert.text('#first-modal h4.modal-title', 'Welcome to darkwire.io ' + APPVER);
});
});
describe('closing the initial modal', () => {
before((done) => {
browser.pressButton('#first-modal .modal-footer button', done);
return browser.pressButton('#first-modal .modal-footer button', done);
});
it('should close the modal and show the main chat page', () => {
@ -68,7 +77,9 @@ describe('Visiting /', () => {
it('should send message', () => {
browser.tabs.current = 0;
browser.assert.text('body', /Hello world/);
browser.wait('1s', () => {
browser.assert.text('.messageBody', /Hello world/);
});
});
});