|
|
|
@ -4,26 +4,18 @@ const process = require('process'); |
|
|
|
const process_mock = jest.spyOn(process, 'exit').mockImplementation(() => true); |
|
|
|
const process_mock = jest.spyOn(process, 'exit').mockImplementation(() => true); |
|
|
|
|
|
|
|
|
|
|
|
describe('test parse args', () => { |
|
|
|
describe('test parse args', () => { |
|
|
|
it('parses a single page id with -p', () => { |
|
|
|
it.only('parses help options', () => { |
|
|
|
const res = parse_args(['-p', 'foo']); |
|
|
|
const res = parse_args(['livesentralen']); |
|
|
|
expect(res.page_id).toEqual('https://www.facebook.com/foo/events/'); |
|
|
|
expect(res.page_id).toEqual( |
|
|
|
|
|
|
|
'https://www.facebook.com/livesentralen/events/', |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
it.only('parses help options', () => { |
|
|
|
|
|
|
|
const res = parse_args(['"livesentralen"']); |
|
|
|
|
|
|
|
expect(res.page_id).toEqual( |
|
|
|
|
|
|
|
'https://www.facebook.com/livesentralen/events/', |
|
|
|
|
|
|
|
); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('parses a single page id with -p', () => { |
|
|
|
|
|
|
|
const res = parse_args(['-p', '"foo"']); |
|
|
|
|
|
|
|
expect(res.page_id).toEqual('https://www.facebook.com/foo/events/'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('parses a single page id with --page', () => { |
|
|
|
|
|
|
|
const res = parse_args(['--page=foo']); |
|
|
|
|
|
|
|
expect(res.page_id).toEqual('https://www.facebook.com/foo/events/'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('parses a single page id with --page', () => { |
|
|
|
|
|
|
|
const res = parse_args(['--page="foo"']); |
|
|
|
|
|
|
|
expect(res.page_id).toEqual('https://www.facebook.com/foo/events/'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
['-?', '--help', '-h'].forEach((param) => { |
|
|
|
['-?', '--help', '-h'].forEach((param) => { |
|
|
|
it('parses help options', () => { |
|
|
|
it('parses help options', () => { |
|
|
|
const res = parse_args([param]); |
|
|
|
const res = parse_args([param]); |
|
|
|
|