Skip to content

Commit 1e3149d

Browse files
author
nicola
committed
avoiding starting server in http and patch tests
1 parent 9ab822f commit 1e3149d

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎test/http.js‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ describe('HTTP APIs', function() {
3838
return handler;
3939
};
4040

41-
var address = 'http://localhost:3457';
42-
var ldpServer = ldnode.createServer({
41+
var ldpServer = ldnode({
4342
root: __dirname + '/resources'
4443
});
45-
ldpServer.listen(3457);
4644

4745
var suffixAcl = ".acl";
4846
var suffixMeta = ".meta";
4947

50-
var server = supertest(address);
48+
var server = supertest(ldpServer);
5149

5250
describe('GET Root container', function() {
5351
it('should have Access-Control-Allow-Origin as the req.Origin', function(done) {
@@ -273,7 +271,7 @@ describe('HTTP APIs', function() {
273271
.send(postRequest1Body)
274272
.set('content-type', 'text/turtle')
275273
.set('slug', 'post-resource-1')
276-
.expect('location', address + '/post-resource-1.ttl')
274+
.expect('location', /\/post-resource-1.ttl/)
277275
.expect(hasHeader('describedBy', suffixMeta))
278276
.expect(hasHeader('acl', suffixAcl))
279277
.expect(201, done);
@@ -302,7 +300,7 @@ describe('HTTP APIs', function() {
302300
.end(done);
303301
});
304302
it('Should be able to delete newly created resource', function(done) {
305-
server.delete('/' + S(postResourceName).chompLeft(address).s)
303+
server.delete('/' + postResourceName.replace(/https?\:\/\/127.0.0.1:[0-9]*\//, ''))
306304
.expect(200, done);
307305
});
308306
it('Should create container', function(done) {

‎test/patch.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ var read = require('./test-utils').read;
1414

1515
describe('PATCH', function () {
1616
// Starting LDP
17-
var ldp = ldnode.createServer({
17+
var ldp = ldnode({
1818
root: __dirname + '/resources/sampleContainer',
1919
mount: '/test'
2020
});
21-
ldp.listen(3453);
22-
var server = supertest('http://localhost:3453/test');
21+
var server = supertest(ldp);
2322

2423
describe('DELETE', function () {
2524
it('should be an empty resource if last triple is deleted', function (done) {

0 commit comments

Comments
 (0)