Skip to content

Commit cda9b95

Browse files
author
Anthony Du Pont
committed
Revert Unit Tests Updates
1 parent 6c6fcfd commit cda9b95

File tree

2 files changed

+5
-64
lines changed

2 files changed

+5
-64
lines changed

test/index.html

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/index.js

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,11 @@
11
// Dependencies
22
const { expect } = require('chai');
3-
const express = require('express');
4-
const puppeteer = require('puppeteer');
5-
6-
// Globals
7-
let APP = null;
8-
let PAGE = null;
9-
let SERVER = null;
10-
let BROWSER = null;
113

124
// Helpers
135
const Helpers = require('../src/helpers.js');
146

157
// Helpers assertions
168
describe('Helpers', () => {
17-
before((done) => {
18-
// Start Express server
19-
APP = express();
20-
21-
// Serve static files
22-
APP.use(express.static(__dirname));
23-
24-
// Listen port
25-
SERVER = APP.listen(3000, () => {
26-
// Start Puppeteer
27-
puppeteer.launch({ headless: false }).then(browser => {
28-
// Save browser
29-
BROWSER = browser;
30-
31-
// Create page
32-
BROWSER.newPage().then(page => {
33-
// Save page
34-
PAGE = page;
35-
36-
// Go to Express server
37-
PAGE.goto('http://localhost:3000').then(() => done());
38-
});
39-
});
40-
});
41-
});
42-
439
describe('Helpers.getOrigin', () => {
4410
it('Should return `http://bar.com` from `http://bar.com/foo/bar` URL.', () => {
4511
// Fake URL
@@ -147,14 +113,11 @@ describe('Helpers', () => {
147113

148114
describe('Helpers.getTitle', () => {
149115
it('Should return the `title` value from a given HTML', () => {
150-
// Get HTML
151-
// PAGE.evaluate(() => {
152-
// // Get HTML
153-
// const html = document.documentElement.outerHTML;
154-
155-
// // Assertion
156-
// expect(Helpers.getTitle(html)).to.be.equal('Puppeteer');
157-
// });
116+
// Fake HTML
117+
const html = '<title>Hello</title>';
118+
119+
// Assertion
120+
expect(Helpers.getTitle(html)).to.be.equal('Hello');
158121
});
159122

160123
it('Should return the nothing if no title a given HTML', () => {
@@ -184,12 +147,4 @@ describe('Helpers', () => {
184147
expect(Helpers.camelize(string)).to.be.equal('both');
185148
});
186149
});
187-
188-
after((done) => {
189-
// Close Express server
190-
SERVER.close();
191-
192-
// Close Puppeteer server
193-
BROWSER.close().then(() => done());
194-
});
195150
});

0 commit comments

Comments
 (0)