Skip to content

Commit

Permalink
Issue 1016: Initital attempt at using fetch over request
Browse files Browse the repository at this point in the history
  • Loading branch information
DevLab2425 committed Oct 19, 2023
1 parent 60971b1 commit bc5eb6c
Showing 1 changed file with 9 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
import chai from 'chai';
import path from 'path';
import request from 'request';
import { Runner } from 'gallinago';
import { fileURLToPath, URL } from 'url';
import { runSmokeTest } from '../../../../../test/smoke-test.js';
Expand Down Expand Up @@ -58,37 +57,23 @@ describe('Develop Greenwood With: ', function() {

describe('Develop command specific .ts behaviors', function() {
let response = {};
let data;

before(async function() {
return new Promise((resolve, reject) => {
request.get({
url: `http://127.0.0.1:${port}/main.ts`
}, (err, res) => {
if (err) {
reject();
}

response = res;

resolve();
});
});
response = await fetch(`http://127.0.0.1:${port}/main.ts`);
data = await response.text();
});

it('should return a 200', function(done) {
expect(response.statusCode).to.equal(200);

done();
it('should return a 200', function() {
expect(response.status).to.equal(200);
});

it('should return the correct content type', function(done) {
expect(response.headers['content-type']).to.equal('text/javascript');
done();
it('should return the correct content type', function() {
expect(response.headers.get('content-type')).to.contain('text/javascript');
});

it('should return an ECMAScript module', function(done) {
expect(response.body.trim().indexOf('const user')).to.equal(0);
done();
it('should return an ECMAScript module', function() {
expect(data.trim().indexOf('const user')).to.equal(0);
});
});
});
Expand Down

0 comments on commit bc5eb6c

Please sign in to comment.