|
1 |
| -const fs = require('fs'); |
2 | 1 | const { exec } = require('../../../src/utils');
|
3 | 2 |
|
4 |
| -describe('CML e2e', () => { |
| 3 | +describe('CML cli test', () => { |
5 | 4 | test('cml publish --help', async () => {
|
6 | 5 | const output = await exec(`node ./bin/cml.js publish --help`);
|
7 | 6 |
|
@@ -29,82 +28,4 @@ describe('CML e2e', () => {
|
29 | 28 | --mime-type MIME type [string] [default: infer from the file contents]"
|
30 | 29 | `);
|
31 | 30 | });
|
32 |
| - |
33 |
| - test('cml publish assets/logo.png --md', async () => { |
34 |
| - const output = await exec(`node ./bin/cml.js publish assets/logo.png --md`); |
35 |
| - |
36 |
| - expect(output.startsWith(').toBe(true); |
37 |
| - }); |
38 |
| - |
39 |
| - test('cml publish assets/logo.png', async () => { |
40 |
| - const output = await exec(`node ./bin/cml.js publish assets/logo.png`); |
41 |
| - |
42 |
| - expect(output.startsWith('https://')).toBe(true); |
43 |
| - }); |
44 |
| - |
45 |
| - test('cml publish assets/logo.pdf --md', async () => { |
46 |
| - const title = 'this is awesome'; |
47 |
| - const output = await exec( |
48 |
| - `node ./bin/cml.js publish assets/logo.pdf --md --title '${title}'` |
49 |
| - ); |
50 |
| - |
51 |
| - expect(output.startsWith(`[${title}](`)).toBe(true); |
52 |
| - }); |
53 |
| - |
54 |
| - test('cml publish assets/logo.pdf', async () => { |
55 |
| - const output = await exec(`node ./bin/cml.js publish assets/logo.pdf`); |
56 |
| - |
57 |
| - expect(output.startsWith('https://')).toBe(true); |
58 |
| - }); |
59 |
| - |
60 |
| - test('cml publish assets/test.svg --md', async () => { |
61 |
| - const title = 'this is awesome'; |
62 |
| - const output = await exec( |
63 |
| - `node ./bin/cml.js publish assets/test.svg --md --title '${title}'` |
64 |
| - ); |
65 |
| - |
66 |
| - expect(output.startsWith(' && output.endsWith(`${title}")`)).toBe( |
67 |
| - true |
68 |
| - ); |
69 |
| - }); |
70 |
| - |
71 |
| - test('cml publish assets/test.svg', async () => { |
72 |
| - const output = await exec(`node ./bin/cml.js publish assets/test.svg`); |
73 |
| - |
74 |
| - expect(output.startsWith('https://')).toBe(true); |
75 |
| - }); |
76 |
| - |
77 |
| - test('cml publish assets/logo.pdf to file', async () => { |
78 |
| - const file = `cml-publish-test.md`; |
79 |
| - |
80 |
| - await exec(`node ./bin/cml.js publish assets/logo.pdf --file ${file}`); |
81 |
| - |
82 |
| - expect(fs.existsSync(file)).toBe(true); |
83 |
| - await fs.promises.unlink(file); |
84 |
| - }); |
85 |
| - |
86 |
| - test('cml publish assets/vega-lite.json', async () => { |
87 |
| - const output = await exec( |
88 |
| - `node ./bin/cml.js publish --mime-type=application/json assets/vega-lite.json` |
89 |
| - ); |
90 |
| - |
91 |
| - expect(output.startsWith('https://')).toBe(true); |
92 |
| - expect(output.includes('cml=json')).toBe(true); |
93 |
| - }); |
94 |
| - |
95 |
| - test('cml publish assets/test.svg in Gitlab storage', async () => { |
96 |
| - const { TEST_GITLAB_REPO: repo, TEST_GITLAB_TOKEN: token } = process.env; |
97 |
| - |
98 |
| - const output = await exec( |
99 |
| - `node ./bin/cml.js publish --repo=${repo} --token=${token} --gitlab-uploads assets/test.svg` |
100 |
| - ); |
101 |
| - |
102 |
| - expect(output.startsWith('https://')).toBe(true); |
103 |
| - }); |
104 |
| - |
105 |
| - test('cml publish /nonexistent produces file error', async () => { |
106 |
| - await expect( |
107 |
| - exec('node ./bin/cml.js publish /nonexistent') |
108 |
| - ).rejects.toThrowError('ENOENT'); |
109 |
| - }); |
110 | 31 | });
|
0 commit comments