Include tests

This commit is contained in:
mickie 2021-08-18 20:16:30 -05:00
parent aa0f0ee70d
commit 0104b27bbe
2 changed files with 35 additions and 121 deletions

View File

@ -1,25 +1,25 @@
// import sinon from 'sinon'; import sinon from 'sinon';
// import { App } from '../lib/app'; import { App } from '../lib/app';
// import * as Dom from '../lib/dom'; import * as Dom from '../lib/dom';
// describe('testing App', () => { describe('testing App', () => {
// let sandboxes; let sandboxes;
// let renderDateTime; let renderItems;
// beforeEach(() => { beforeEach(() => {
// sandboxes = sinon.createSandbox(); sandboxes = sinon.createSandbox();
// renderDateTime = sandboxes.stub(Dom, 'renderDateTime'); renderItems = sandboxes.stub(Dom, 'renderItems');
// }); });
// afterEach(() => { afterEach(() => {
// sandboxes.restore(); sandboxes.restore();
// }); });
// describe('testing App', () => { describe('testing App', () => {
// it('should return Thu Nov 19 23:00', () => { it('app is rendered', () => {
// const app = new App(); const app = new App();
// app.render(); app.render();
// expect(renderDateTime.called).toBeTruthy(); expect(renderItems.called).toBeTruthy();
// }); });
// }); });
// }); });

View File

@ -1,101 +1,15 @@
// import sinon from 'sinon'; import sinon from 'sinon';
// import { getDisplayDateTime, getPeriod, getPalette } from '../lib/utils'; import { generateArray } from '../lib/utils';
import * as instance from '../lib/instances';
// describe('testing utils', () => { describe('testing utils', () => {
// let sandboxes; describe('testing generateArray', () => {
it('should return an array of instances', () => {
// beforeEach(() => { const actual = generateArray(instance);
// sandboxes = sinon.createSandbox(); const testInstances = actual.slice(1, 3); // Friendica and GNUsocial
// sandboxes.useFakeTimers({ const expected = [instance.friendica, instance.gnusocial];
// now: new Date(2020, 10, 19, 23, 0), expect(testInstances).toEqual(expected);
// }); });
// }); });
// TODO include the rest
// afterEach(() => { });
// sandboxes.restore();
// });
// describe('testing getDisplayDateTime', () => {
// it('should return Thu Nov 19 23:00', () => {
// const actual = getDisplayDateTime();
// const expected = { date: 'Thu Nov 19', time: '23:00', period: 'night' };
// expect(actual).toEqual(expected);
// });
// it('should return Thu Nov 19 01:00', () => {
// sinon.useFakeTimers({
// now: new Date(2020, 10, 19, 1, 0),
// });
// const actual = getDisplayDateTime();
// const expected = { date: 'Thu Nov 19', time: '01:00', period: 'night' };
// expect(actual).toEqual(expected);
// });
// it('should return Thu Nov 19 23:23', () => {
// sinon.useFakeTimers({
// now: new Date(2020, 10, 19, 23, 23),
// });
// const actual = getDisplayDateTime();
// const expected = { date: 'Thu Nov 19', time: '23:23', period: 'night' };
// expect(actual).toEqual(expected);
// });
// });
// describe('testing getPeriod', () => {
// it('should return morning - 05:00 AM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 5, 0));
// const expected = 'morning';
// expect(actual).toEqual(expected);
// });
// it('should return morning - 11:59 AM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 11, 59));
// const expected = 'morning';
// expect(actual).toEqual(expected);
// });
// it('should return afternoon - 12:00 PM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 12, 0));
// const expected = 'afternoon';
// expect(actual).toEqual(expected);
// });
// it('should return afternoon - 04:59 PM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 16, 59));
// const expected = 'afternoon';
// expect(actual).toEqual(expected);
// });
// it('should return night - 05:00 PM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 17, 0));
// const expected = 'night';
// expect(actual).toEqual(expected);
// });
// it('should return night - 04:59 AM', () => {
// const actual = getPeriod(new Date(2020, 10, 19, 4, 59));
// const expected = 'night';
// expect(actual).toEqual(expected);
// });
// });
// describe('testing getPalette', () => {
// it('should return morning color code - #282e54', () => {
// const actual = getPalette('morning');
// const expected = '#282e54';
// expect(actual).toEqual(expected);
// });
// it('should return afternoon color code - #000000', () => {
// const actual = getPalette('afternoon');
// const expected = '#000000';
// expect(actual).toEqual(expected);
// });
// it('should return morning color code - #ffdd91', () => {
// const actual = getPalette('night');
// const expected = '#ffdd91';
// expect(actual).toEqual(expected);
// });
// });
// });