Setup CI tests (#100)
* use @xarc/xrun to streamline tasks in an imperative manner * add lint-staged/husky for git hook tasks * run prettier across all files * fixing tests * add ci test workflow * add a ci workflow * remove precommit in favor of husky * add .prettierrc.js * reformat with prettier
This commit is contained in:
@@ -3,9 +3,9 @@ var sinon = require('sinon');
|
||||
var chrome = require('sinon-chrome');
|
||||
var expect = chai.expect;
|
||||
|
||||
describe('Chrome Dev Tools', function() {
|
||||
it('should work', function() {
|
||||
chrome.browserAction.setTitle({title: 'hello'});
|
||||
sinon.assert.calledOnce(chrome.browserAction.setTitle);
|
||||
});
|
||||
describe('Chrome Dev Tools', function () {
|
||||
it('should work', function () {
|
||||
chrome.browserAction.setTitle({ title: 'hello' });
|
||||
sinon.assert.calledOnce(chrome.browserAction.setTitle);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
var chai = require('chai');
|
||||
var expect = chai.expect;
|
||||
|
||||
//import changeExtensionIcon from '../../assets/js/helpers/changeExtensionIcon';
|
||||
var changeExtensionIcon = require('../../assets/js/helpers/changeExtensionIcon');
|
||||
|
||||
describe('changeExtensionIcon', function() {
|
||||
it('should be a function', function() {
|
||||
expect(changeExtensionIcon).to.be.a('function');
|
||||
});
|
||||
});
|
||||
describe('changeExtensionIcon', function () {
|
||||
it('should be a function', function () {
|
||||
expect(changeExtensionIcon).to.be.a('function');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
var chai = require('chai');
|
||||
var expect = chai.expect;
|
||||
|
||||
//import changeExtensionState from '../../assets/js/helpers/changeExtensionState';
|
||||
var changeExtensionState = require('../../assets/js/helpers/changeExtensionState');
|
||||
|
||||
describe('changeExtensionState', function() {
|
||||
it('should be a function', function() {
|
||||
expect(changeExtensionState).to.be.a('function');
|
||||
});
|
||||
});
|
||||
describe('changeExtensionState', function () {
|
||||
beforeEach(() => {
|
||||
browser = window;
|
||||
});
|
||||
it('should be a function', function () {
|
||||
expect(changeExtensionState).to.be.a('function');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,16 +3,15 @@ var sinon = require('sinon-chai');
|
||||
var chrome = require('sinon-chrome');
|
||||
var expect = chai.expect;
|
||||
|
||||
//import changeExtensionTooltip from '../../assets/js/helpers/changeExtensionTooltip';
|
||||
var changeExtensionTooltip = require('../../assets/js/helpers/changeExtensionTooltip');
|
||||
describe('changeExtensionTooltip', function () {
|
||||
it('should be a function', function () {
|
||||
expect(changeExtensionTooltip).to.be.a('function');
|
||||
});
|
||||
|
||||
describe('changeExtensionTooltip', function() {
|
||||
it('should be a function', function() {
|
||||
expect(changeExtensionTooltip).to.be.a('function');
|
||||
});
|
||||
|
||||
// it('should change the extension tooltip', function() {
|
||||
// changeExtensionTooltip('WakaTime');
|
||||
// expect(chrome.browserAction.setTitle).toHaveBeenCalledWith({title: 'Wakatime'});
|
||||
// sinon.assert.calledWithMatch(chrome.browserAction.setTitle, {title: 'WakaTime'});
|
||||
// });
|
||||
// it('should change the extension tooltip', function() {
|
||||
// changeExtensionTooltip('WakaTime');
|
||||
// expect(chrome.browserAction.setTitle).toHaveBeenCalledWith({title: 'Wakatime'});
|
||||
// sinon.assert.calledWithMatch(chrome.browserAction.setTitle, {title: 'WakaTime'});
|
||||
// });
|
||||
});
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
var chai = require('chai');
|
||||
var expect = chai.expect;
|
||||
|
||||
//import contains from '../../assets/js/helpers/contains';
|
||||
var contains = require('../../assets/js/helpers/contains');
|
||||
|
||||
describe('contains', function() {
|
||||
it('should be a function', function() {
|
||||
expect(contains).to.be.a('function');
|
||||
});
|
||||
describe('contains', function () {
|
||||
it('should be a function', function () {
|
||||
expect(contains).to.be.a('function');
|
||||
});
|
||||
|
||||
it('should match url against blacklist and return true', function() {
|
||||
it('should match url against blacklist and return true', function () {
|
||||
var list = 'localhost\ntest.com';
|
||||
|
||||
var list = "localhost\ntest.com";
|
||||
var url = 'http://localhost/fooapp';
|
||||
expect(contains(url, list)).to.equal(true);
|
||||
});
|
||||
|
||||
var url = 'http://localhost/fooapp';
|
||||
expect(contains(url, list)).to.equal(true);
|
||||
});
|
||||
it('should not match url against blacklist and return false', function () {
|
||||
var list = 'localhost2\ntest.com';
|
||||
|
||||
it('should not match url against blacklist and return false', function() {
|
||||
|
||||
var list = "localhost2\ntest.com";
|
||||
|
||||
var url = 'http://localhost/fooapp';
|
||||
expect(contains(url, list)).to.equal(false);
|
||||
});
|
||||
var url = 'http://localhost/fooapp';
|
||||
expect(contains(url, list)).to.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
var chai = require('chai');
|
||||
var expect = chai.expect;
|
||||
|
||||
//import getDomainFromUrl from '../../assets/js/helpers/getDomainFromUrl';
|
||||
var getDomainFromUrl = require('../../assets/js/helpers/getDomainFromUrl');
|
||||
|
||||
describe('getDomainFromUrl', function() {
|
||||
it('should be a function', function() {
|
||||
expect(getDomainFromUrl).to.be.a('function');
|
||||
});
|
||||
describe('getDomainFromUrl', function () {
|
||||
it('should be a function', function () {
|
||||
expect(getDomainFromUrl).to.be.a('function');
|
||||
});
|
||||
|
||||
it('should return the domain', function() {
|
||||
expect(getDomainFromUrl('http://google.com/something/very/secret')).to.equal('http://google.com');
|
||||
it('should return the domain', function () {
|
||||
expect(getDomainFromUrl('http://google.com/something/very/secret')).to.equal(
|
||||
'http://google.com',
|
||||
);
|
||||
|
||||
expect(getDomainFromUrl('http://www.google.com/something/very/secret')).to.equal('http://www.google.com');
|
||||
expect(getDomainFromUrl('http://www.google.com/something/very/secret')).to.equal(
|
||||
'http://www.google.com',
|
||||
);
|
||||
|
||||
// This is not how it was imaged to work, but let's leave it here as a warning.
|
||||
expect(getDomainFromUrl('google.com/something/very/secret')).to.equal('google.com//very');
|
||||
});
|
||||
});
|
||||
// This is not how it was imaged to work, but let's leave it here as a warning.
|
||||
expect(getDomainFromUrl('google.com/something/very/secret')).to.equal('google.com//very');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
var chai = require('chai');
|
||||
var expect = chai.expect;
|
||||
|
||||
//import in_array from '../../assets/js/helpers/in_array';
|
||||
var in_array = require('../../assets/js/helpers/in_array');
|
||||
|
||||
describe('in_array', function() {
|
||||
it('should be a function', function() {
|
||||
expect(in_array).to.be.a('function');
|
||||
});
|
||||
describe('in_array', function () {
|
||||
it('should be a function', function () {
|
||||
expect(in_array).to.be.a('function');
|
||||
});
|
||||
|
||||
it('should find the needle and return true', function() {
|
||||
expect(in_array('4', ['4', '3', '2', '1'])).to.equal(true);
|
||||
});
|
||||
it('should find the needle and return true', function () {
|
||||
expect(in_array('4', ['4', '3', '2', '1'])).to.equal(true);
|
||||
});
|
||||
|
||||
it('should not find the needle and it should return false', function() {
|
||||
expect(in_array('5', ['4', '3', '2', '1'])).to.equal(false);
|
||||
});
|
||||
});
|
||||
it('should not find the needle and it should return false', function () {
|
||||
expect(in_array('5', ['4', '3', '2', '1'])).to.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user