|
|
|
@ -6,38 +6,22 @@ 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('parses a single page id with -p', () => { |
|
|
|
const res = parse_args(['-p', 'foo']); |
|
|
|
const res = parse_args(['-p', 'foo']); |
|
|
|
expect(res.page_ids).toEqual(['https://www.facebook.com/foo/events/']); |
|
|
|
expect(res.page_id).toEqual('https://www.facebook.com/foo/events/'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('parses a single page id with -p', () => { |
|
|
|
it('parses a single page id with -p', () => { |
|
|
|
const res = parse_args(['-p', '"foo"']); |
|
|
|
const res = parse_args(['-p', '"foo"']); |
|
|
|
expect(res.page_ids).toEqual(['https://www.facebook.com/foo/events/']); |
|
|
|
expect(res.page_id).toEqual('https://www.facebook.com/foo/events/'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('parses a single page id with --page', () => { |
|
|
|
it('parses a single page id with --page', () => { |
|
|
|
const res = parse_args(['--page=foo']); |
|
|
|
const res = parse_args(['--page=foo']); |
|
|
|
expect(res.page_ids).toEqual(['https://www.facebook.com/foo/events/']); |
|
|
|
expect(res.page_id).toEqual('https://www.facebook.com/foo/events/'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('parses a single page id with --page', () => { |
|
|
|
it('parses a single page id with --page', () => { |
|
|
|
const res = parse_args(['--page="foo"']); |
|
|
|
const res = parse_args(['--page="foo"']); |
|
|
|
expect(res.page_ids).toEqual(['https://www.facebook.com/foo/events/']); |
|
|
|
expect(res.page_id).toEqual('https://www.facebook.com/foo/events/'); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('parses multiple page ids with --pages', () => { |
|
|
|
|
|
|
|
const res = parse_args(['--pages=foo,bar']); |
|
|
|
|
|
|
|
expect(res.page_ids).toEqual([ |
|
|
|
|
|
|
|
'https://www.facebook.com/foo/events/', |
|
|
|
|
|
|
|
'https://www.facebook.com/bar/events/', |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('parses multiple page ids with --pages', () => { |
|
|
|
|
|
|
|
const res = parse_args(['--pages="foo,bar"']); |
|
|
|
|
|
|
|
expect(res.page_ids).toEqual([ |
|
|
|
|
|
|
|
'https://www.facebook.com/foo/events/', |
|
|
|
|
|
|
|
'https://www.facebook.com/bar/events/', |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
['-?', '--help', '-h'].forEach((param) => { |
|
|
|
['-?', '--help', '-h'].forEach((param) => { |
|
|
|
|