mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-19 11:02:58 +00:00
Started write of tests
This commit is contained in:
parent
7816f2aa87
commit
0a29d92aed
@ -4,4 +4,4 @@ node_js:
|
|||||||
before_script:
|
before_script:
|
||||||
- gulp bundle
|
- gulp bundle
|
||||||
- sleep 5
|
- sleep 5
|
||||||
script: gulp test
|
script: npm test
|
||||||
|
@ -24,11 +24,6 @@ export default class Darkwire {
|
|||||||
return file.data;
|
return file.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
set fileQueue(fileQueue) {
|
|
||||||
this._fileQueue = fileQueue;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
get autoEmbedImages() {
|
get autoEmbedImages() {
|
||||||
return this._autoEmbedImages;
|
return this._autoEmbedImages;
|
||||||
}
|
}
|
||||||
|
10
src/room.js
10
src/room.js
@ -27,7 +27,7 @@ class Room {
|
|||||||
vector: data.vector,
|
vector: data.vector,
|
||||||
secretKeys: data.secretKeys,
|
secretKeys: data.secretKeys,
|
||||||
signature: data.signature,
|
signature: data.signature,
|
||||||
timestamp: new Date
|
timestamp: new Date()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ class Room {
|
|||||||
username: socket.username,
|
username: socket.username,
|
||||||
numUsers: this.numUsers,
|
numUsers: this.numUsers,
|
||||||
users: this.users,
|
users: this.users,
|
||||||
timestamp: new Date
|
timestamp: new Date()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class Room {
|
|||||||
numUsers: this.numUsers,
|
numUsers: this.numUsers,
|
||||||
users: this.users,
|
users: this.users,
|
||||||
id: socket.user.id,
|
id: socket.user.id,
|
||||||
timestamp: new Date
|
timestamp: new Date()
|
||||||
});
|
});
|
||||||
|
|
||||||
// remove room from rooms array
|
// remove room from rooms array
|
||||||
@ -111,7 +111,7 @@ class Room {
|
|||||||
newUsername: data.newUsername,
|
newUsername: data.newUsername,
|
||||||
publicKey: data.publicKey,
|
publicKey: data.publicKey,
|
||||||
users: this.users,
|
users: this.users,
|
||||||
timestamp: new Date
|
timestamp: new Date()
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -119,7 +119,7 @@ class Room {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get roomId() {
|
roomId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
<h4 class="modal-title">About</h4>
|
<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>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
{{>partials/disclaimer}}
|
{{>partials/disclaimer}}
|
||||||
|
31
test/app.js
31
test/app.js
@ -1,15 +1,18 @@
|
|||||||
|
import appPkg from '../package.json';
|
||||||
import helpers from './helpers';
|
import helpers from './helpers';
|
||||||
import app from '../index';
|
import app from '../index';
|
||||||
import mochaJSCS from 'mocha-jscs';
|
import mochaJSCS from 'mocha-jscs';
|
||||||
import mochaJSHint from 'mocha-jshint';
|
import mochaJSHint from 'mocha-jshint';
|
||||||
|
import Browser from 'zombie';
|
||||||
|
|
||||||
|
const APPVER = 'v' + appPkg.version;
|
||||||
|
|
||||||
const Browser = require('zombie');
|
|
||||||
Browser.localhost('localhost', 3000);
|
Browser.localhost('localhost', 3000);
|
||||||
|
|
||||||
mochaJSCS();
|
mochaJSCS();
|
||||||
mochaJSHint();
|
mochaJSHint();
|
||||||
|
|
||||||
describe('Visiting /', () => {
|
describe('Darkwire', () => {
|
||||||
|
|
||||||
const browser = new Browser();
|
const browser = new Browser();
|
||||||
|
|
||||||
@ -22,19 +25,25 @@ describe('Visiting /', () => {
|
|||||||
browser.visit('/', done);
|
browser.visit('/', done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be successful', () => {
|
describe('Navigate to /', () => {
|
||||||
browser.assert.success();
|
it('should be running released version', () => {
|
||||||
});
|
browser.assert.text('#appVersion', APPVER);
|
||||||
|
});
|
||||||
|
|
||||||
it('should show welcome modal', () => {
|
it('should be successful', () => {
|
||||||
browser.assert.evaluate('$("#first-modal:visible").length', 1);
|
browser.assert.success();
|
||||||
browser.assert.text('#first-modal h4.modal-title', 'Welcome to darkwire.io');
|
});
|
||||||
|
|
||||||
|
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 ' + APPVER);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('closing the initial modal', () => {
|
describe('closing the initial modal', () => {
|
||||||
|
|
||||||
before((done) => {
|
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', () => {
|
it('should close the modal and show the main chat page', () => {
|
||||||
@ -68,7 +77,9 @@ describe('Visiting /', () => {
|
|||||||
|
|
||||||
it('should send message', () => {
|
it('should send message', () => {
|
||||||
browser.tabs.current = 0;
|
browser.tabs.current = 0;
|
||||||
browser.assert.text('body', /Hello world/);
|
browser.wait('1s', () => {
|
||||||
|
browser.assert.text('.messageBody', /Hello world/);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user