Skip to content

Commit

Permalink
test: use different ports
Browse files Browse the repository at this point in the history
  • Loading branch information
EslamHiko committed Jun 6, 2019
1 parent e3c3475 commit c853649
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions test/ContentBase.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,50 +256,59 @@ describe('ContentBase', () => {
});

describe('testing single & multiple external paths', () => {
afterAll((done) => {
testServer.close(() => {
done();
});
});
it('Should throw exception (string)', (done) => {
try {
// eslint-disable-next-line no-unused-vars
server = testServer.start(config, {
port: 9004,
contentBase: 'https://example.com/',
watchContentBase: true,
});

expect(true).toBe(false);
} catch (e) {
expect(e.message).toBe('Watching remote files is not supported.');
testServer.close(() => {
done();
});
done();
}
});
it('Should throw exception (array)', (done) => {
try {
// eslint-disable-next-line no-unused-vars
server = testServer.start(config, {
port: 9003,
contentBase: [contentBasePublic, 'https://example.com/'],
watchContentBase: true,
});

expect(true).toBe(false);
} catch (e) {
expect(e.message).toBe('Watching remote files is not supported.');
testServer.close(() => {
done();
});
done();
}
});
});

describe('testing single & multiple internal paths', () => {
afterAll((done) => {
testServer.close(() => {
done();
});
});
it('Should not throw exception (string)', (done) => {
try {
// eslint-disable-next-line no-unused-vars
server = testServer.start(config, {
port: 9002,
contentBase: contentBasePublic,
watchContentBase: true,
});

testServer.close(() => {
server.close(() => {
done();
});
} catch (e) {
Expand All @@ -310,11 +319,12 @@ describe('ContentBase', () => {
try {
// eslint-disable-next-line no-unused-vars
server = testServer.start(config, {
port: 9001,
contentBase: [contentBasePublic, contentBaseOther],
watchContentBase: true,
});

testServer.close(() => {
server.close(() => {
done();
});
} catch (e) {
Expand Down

0 comments on commit c853649

Please sign in to comment.