1 | const execa = require('execa');
|
2 | const fs = require('fs');
|
3 |
|
4 | afterEach(done => {
|
5 | fs.access('sitemap.xml', err => {
|
6 | if (!err) {
|
7 | fs.unlink('sitemap.xml', done);
|
8 | }
|
9 | });
|
10 | });
|
11 |
|
12 | test('should create sitemap file', () => {
|
13 | expect.assertions(1);
|
14 |
|
15 | return execa('node', [
|
16 | 'index.js',
|
17 | 'https://larsgraubner.com',
|
18 | 'sitemap.xml',
|
19 | ]).then(() => {
|
20 | expect(() => fs.accessSync('sitemap.xml')).not.toThrow();
|
21 | });
|
22 | });
|
23 |
|
24 | test('should write to stdout in verbose mode', () => {
|
25 | expect.assertions(1);
|
26 |
|
27 | return execa('node', [
|
28 | 'index.js',
|
29 | 'https://larsgraubner.com',
|
30 | 'sitemap.xml',
|
31 | '--verbose',
|
32 | ]).then(result => {
|
33 | expect(result.stdout).not.toBe('');
|
34 | });
|
35 | });
|