Add tests missed in last commit
This commit is contained in:
parent
e2abb90d14
commit
6e61a13354
21
test/customembed.js
Normal file
21
test/customembed.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
const customembed = require('../lib/customembed');
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
|
describe('customembed', () => {
|
||||||
|
describe('#filter', () => {
|
||||||
|
it('rejects plain-HTTP <embed> inputs', () => {
|
||||||
|
const input = '<embed src="http://foo.bar/baz.swf" type="application/x-shockwave-flash"></embed>';
|
||||||
|
assert.throws(() => { customembed.filter(input) }, /must be HTTPS/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects plain-HTTP <object> inputs', () => {
|
||||||
|
const input = '<object data="http://foo.bar/baz.swf" type="application/x-shockwave-flash"></object>';
|
||||||
|
assert.throws(() => { customembed.filter(input) }, /must be HTTPS/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects plain-HTTP <iframe> inputs', () => {
|
||||||
|
const input = '<iframe src="http://foo.bar/baz.swf"></iframe>';
|
||||||
|
assert.throws(() => { customembed.filter(input) }, /must be HTTPS/);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
16
test/ffmpeg.js
Normal file
16
test/ffmpeg.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
const assert = require('assert');
|
||||||
|
const ffmpeg = require('../lib/ffmpeg');
|
||||||
|
const Config = require('../lib/config');
|
||||||
|
|
||||||
|
describe('ffmpeg', () => {
|
||||||
|
describe('#query', () => {
|
||||||
|
it('rejects plain http links', done => {
|
||||||
|
Config.set('ffmpeg.enabled', true);
|
||||||
|
ffmpeg.query('http://foo.bar/baz.mp4', err => {
|
||||||
|
assert(/begins with 'https:/.test(err),
|
||||||
|
`Expected error due to plain HTTP but got "${err}"`);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue