Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
harveysanders committed Jan 30, 2024
1 parent 08fa11f commit f0bc98c
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions test/test-view.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
var
config = require('../config'),
fs = require('fs-extra'),
chai = require('./helpers/chai'),
sinon = require('sinon'),
mocha = require('mocha'),
stdin = require('mock-stdin').stdin(),
view = require('../view');
/* global describe it expect after afterEach */
const config = require('../config');
const stdin = require('mock-stdin').stdin();
const view = require('../view');

// TODO : figure out why these tests pass individually, but fail when running suite.
describe.skip('view', function () {
Expand All @@ -23,16 +19,18 @@ describe.skip('view', function () {
});

it('recursively allows user to re-enter input from stdin', function () {
var promise = view.promptForInput('Give us some test input:').then(function (input) {
console.log('Final input is ', input);
expect(input).to.equal('jfraboni');
});
stdin.send("jbaloni\n", "ascii");
stdin.send("n\n", "ascii");
const promise = view
.promptForInput('Give us some test input:')
.then(function (input) {
console.log('Final input is ', input);
expect(input).to.equal('jfraboni');
});
stdin.send('jbaloni\n', 'ascii');
stdin.send('n\n', 'ascii');

setTimeout(function () {
stdin.send("jfraboni\n", "ascii");
stdin.send("Y\n", "ascii");
stdin.send('jfraboni\n', 'ascii');
stdin.send('Y\n', 'ascii');
}, 100);
return promise;
});
Expand All @@ -45,12 +43,14 @@ describe.skip('view', function () {

this.timeout(15000);
it('returns requested input from stdin', function () {
var promise = view.promptForInput('Give us some test input:').then(function (input) {
console.log('Input is', input);
expect(input).to.equal('jfraboni');
});
stdin.send("jfraboni\n", "ascii");
stdin.send("Y\n", "ascii");
const promise = view
.promptForInput('Give us some test input:')
.then(function (input) {
console.log('Input is', input);
expect(input).to.equal('jfraboni');
});
stdin.send('jfraboni\n', 'ascii');
stdin.send('Y\n', 'ascii');
return promise;
});
});
Expand All @@ -61,15 +61,15 @@ describe.skip('view', function () {
});

this.timeout(3000);
var message = config.github.msg.enterUsername;
const message = config.github.msg.enterUsername;
it('NOTE: This test fails if run together with the other tests in this suite - there is some issue with the mock-sndin\nreturns requested input from stdin', function (done) {
view.inquireForInput(message, function (err, username) {
expect(err).to.be.null;
expect(username).to.equal('jfraboni');
done();
});
stdin.send("jfraboni\n", "ascii");
stdin.send("Y\n", "ascii");
stdin.send('jfraboni\n', 'ascii');
stdin.send('Y\n', 'ascii');
});
});

Expand All @@ -79,19 +79,19 @@ describe.skip('view', function () {
});

this.timeout(3000);
var message = config.github.msg.enterUsername;
const message = config.github.msg.enterUsername;
it('NOTE: This test fails if run together with the other tests in this suite - there is some issue with the mock-sndin\nrecursively allows user to re-enter input from stdin', function (done) {
view.inquireForInput(message, function (err, username) {
expect(err).to.be.null;
expect(username).to.equal('jfraboni');
done();
});
stdin.send("jbaloni\n", "ascii");
stdin.send("n\n", "ascii");
stdin.send('jbaloni\n', 'ascii');
stdin.send('n\n', 'ascii');
setTimeout(function () {
stdin.send("jfraboni\n", "ascii");
stdin.send("Y\n", "ascii");
stdin.send('jfraboni\n', 'ascii');
stdin.send('Y\n', 'ascii');
}, 100);
});
});
});
});

0 comments on commit f0bc98c

Please sign in to comment.