-
Notifications
You must be signed in to change notification settings - Fork 344
/
Copy pathutils.test.js
36 lines (30 loc) · 911 Bytes
/
utils.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const { exec, upload } = require('./utils');
describe('exec tests', () => {
test('exec is await and outputs hello', async () => {
const output = await exec('echo', 'hello');
expect(output).toMatch('hello');
});
test('Command rejects if failure', async () => {
let error;
try {
await exec('this_command_fails');
} catch (err) {
error = err;
}
expect(error).not.toBeNull();
});
});
describe('upload tests', () => {
test('image/png', async () => {
const { mime } = await upload({ path: 'assets/logo.png' });
expect(mime).toBe('image/png');
});
test('application/pdf', async () => {
const { mime } = await upload({ path: 'assets/logo.pdf' });
expect(mime).toBe('application/pdf');
});
test('image/svg+xml', async () => {
const { mime } = await upload({ path: 'assets/test.svg' });
expect(mime).toBe('image/svg+xml');
});
});