Skip to content

Commit 5855c8d

Browse files
author
Guilherme Oenning
committed
fixed eol test
1 parent d8524d7 commit 5855c8d

File tree

6 files changed

+15
-42
lines changed

6 files changed

+15
-42
lines changed

tests/custom-config-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var expect = require('chai').expect;
2+
var eol = require('os').EOL;
23

34
module.exports = function(server) {
45
describe('Custom Configuration Tests', function() {
@@ -10,7 +11,7 @@ module.exports = function(server) {
1011
var ids = JSON.parse(response.headers['x-miniprofiler-ids']);
1112
expect(ids).to.have.lengthOf(1);
1213

13-
expect(body).to.be.equal(`<script async type="text/javascript" id="mini-profiler" src="/mini-profiler-resources/includes.js?v=" data-version="" data-path="/mini-profiler-resources/" data-current-id="${ids[0]}" data-ids="${ids[0]}" data-position="right" data-trivial="true" data-children="false" data-max-traces="15" data-controls="true" data-authorized="true" data-toggle-shortcut="" data-start-hidden="false" data-trivial-milliseconds="2.5"></script>\r\n`);
14+
expect(body).to.be.equal(`<script async type="text/javascript" id="mini-profiler" src="/mini-profiler-resources/includes.js?v=" data-version="" data-path="/mini-profiler-resources/" data-current-id="${ids[0]}" data-ids="${ids[0]}" data-position="right" data-trivial="true" data-children="false" data-max-traces="15" data-controls="true" data-authorized="true" data-toggle-shortcut="" data-start-hidden="false" data-trivial-milliseconds="2.5"></script>` + eol);
1415
done();
1516
});
1617
});

tests/servers/express/default.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ app.get('/step', (req, res) => {
1515
});
1616
});
1717

18-
app.get('/step-error', (req, res) => {
19-
req.miniprofiler.step('Step', () => {
20-
throw new Error('Ouch!');
21-
});
22-
});
23-
2418
app.get('/step-two', (req, res) => {
2519
req.miniprofiler.step('Step 1', () => {
2620
req.miniprofiler.step('Step 2', () => {

tests/servers/hapi/default.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@ server.route({
3131
}
3232
});
3333

34-
server.route({
35-
method: 'GET',
36-
path:'/step-error',
37-
handler: function(request, reply) {
38-
request.raw.req.miniprofiler.step('Step', () => {
39-
throw new Error('Ouch!');
40-
});
41-
}
42-
});
43-
4434
server.route({
4535
method: 'GET',
4636
path:'/step-two',

tests/servers/http/default.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ var server = http.createServer((req, res) => {
1616
req.miniprofiler.step('Step', () => {
1717
res.end(req.miniprofiler.include());
1818
});
19-
} else if (reqPath == '/step-error') {
20-
req.miniprofiler.step('Step', () => {
21-
throw new Error('Ouch!');
22-
});
2319
} else if (reqPath == '/step-two') {
2420
req.miniprofiler.step('Step 1', () => {
2521
req.miniprofiler.step('Step 2', () => {

tests/servers/koa/default.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ app.use(route.get('/step', function *(){
1515
});
1616
}));
1717

18-
app.use(route.get('/step-error', function *(){
19-
this.req.miniprofiler.step('Step', () => {
20-
throw new Error('Ouch!');
21-
});
22-
}));
23-
2418
app.use(route.get('/step-two', function *(){
2519
this.req.miniprofiler.step('Step 1', () => {
2620
this.req.miniprofiler.step('Step 2', () => {

tests/step-test.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,24 @@ module.exports = function(server) {
2121
});
2222
});
2323

24-
for(var path of ['/step', '/step-error']) {
25-
it(`${path} route should profile one step`, function(done) {
26-
server.get(path, (err, response) => {
27-
var ids = JSON.parse(response.headers['x-miniprofiler-ids']);
28-
expect(ids).to.have.lengthOf(1);
24+
it('/step route should profile one step', function(done) {
25+
server.get('/step', (err, response) => {
26+
var ids = JSON.parse(response.headers['x-miniprofiler-ids']);
27+
expect(ids).to.have.lengthOf(1);
2928

30-
server.post('/mini-profiler-resources/results', { id: ids[0], popup: 1 }, (err, response, body) => {
31-
var result = JSON.parse(body);
32-
expect(result.Id).to.equal(ids[0]);
33-
expect(result.Name).to.equal(path);
34-
expect(result.Root.Children).to.have.lengthOf(1);
29+
server.post('/mini-profiler-resources/results', { id: ids[0], popup: 1 }, (err, response, body) => {
30+
var result = JSON.parse(body);
31+
expect(result.Id).to.equal(ids[0]);
32+
expect(result.Name).to.equal('/step');
33+
expect(result.Root.Children).to.have.lengthOf(1);
3534

36-
expect(result.Root.Children[0].Name).to.equal('Step');
37-
expect(result.Root.Children[0].Children).to.be.empty;
35+
expect(result.Root.Children[0].Name).to.equal('Step');
36+
expect(result.Root.Children[0].Children).to.be.empty;
3837

39-
done();
40-
});
38+
done();
4139
});
4240
});
43-
}
41+
});
4442

4543
it('step-two route should profile two nested step', function(done) {
4644
server.get('/step-two', (err, response) => {

0 commit comments

Comments
 (0)