mirror of https://github.com/Seich/Beau.git
Merge 6d7278339f into 8fcd8b9fd3
This commit is contained in:
commit
28859fa0c4
|
|
@ -1,6 +1,6 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`List Command Should disable formatting when the flag is active. 1`] = `
|
||||
exports[`List Command with flags: --no-format 1`] = `
|
||||
Array [
|
||||
"GET anything https://example.org/anything
|
||||
",
|
||||
|
|
@ -9,7 +9,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`List Command Should list available requests for a given file. 1`] = `
|
||||
exports[`List Command with flags: 1`] = `
|
||||
Array [
|
||||
" HTTP Verb Alias Endpoint
|
||||
",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,20 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Request Command Should output an unformatted version 1`] = `
|
||||
exports[`Request Command with flags: anything --as-json --verbose 1`] = `
|
||||
Array [
|
||||
"{\\"request\\":{\\"body\\":{\\"name\\":\\"David\\"},\\"endpoint\\":\\"https://example.org/anything\\"},\\"response\\":{\\"status\\":200,\\"headers\\":[],\\"body\\":\\"{\\\\\\"hello\\\\\\": \\\\\\"world\\\\\\"}\\"},\\"body\\":\\"{\\\\\\"hello\\\\\\": \\\\\\"world\\\\\\"}\\"}
|
||||
",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Request Command with flags: anything --as-json 1`] = `
|
||||
Array [
|
||||
"{\\"status\\":200,\\"headers\\":[],\\"body\\":\\"{\\\\\\"hello\\\\\\": \\\\\\"world\\\\\\"}\\"}
|
||||
",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Request Command with flags: anything --no-format 1`] = `
|
||||
Array [
|
||||
"200
|
||||
",
|
||||
|
|
@ -13,37 +27,9 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`Request Command Should output nothing 1`] = `Array []`;
|
||||
exports[`Request Command with flags: anything --quiet 1`] = `Array []`;
|
||||
|
||||
exports[`Request Command Should output the response as json 1`] = `
|
||||
Array [
|
||||
"{\\"status\\":200,\\"headers\\":[],\\"body\\":\\"{\\\\\\"hello\\\\\\": \\\\\\"world\\\\\\"}\\"}
|
||||
",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Request Command Should output the response as json verboselly 1`] = `
|
||||
Array [
|
||||
"{\\"request\\":{\\"body\\":{\\"name\\":\\"David\\"},\\"endpoint\\":\\"https://example.org/anything\\"},\\"response\\":{\\"status\\":200,\\"headers\\":[],\\"body\\":\\"{\\\\\\"hello\\\\\\": \\\\\\"world\\\\\\"}\\"},\\"body\\":\\"{\\\\\\"hello\\\\\\": \\\\\\"world\\\\\\"}\\"}
|
||||
",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Request Command Should request the given alias 1`] = `
|
||||
Array [
|
||||
"",
|
||||
" Status Endpoint
|
||||
",
|
||||
" 200 https://example.org/anything
|
||||
",
|
||||
"
|
||||
",
|
||||
"\\"{\\"hello\\": \\"world\\"}\\"
|
||||
",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Request Command Should show all information available when being verbose 1`] = `
|
||||
exports[`Request Command with flags: anything --verbose 1`] = `
|
||||
Array [
|
||||
"",
|
||||
" Status Endpoint
|
||||
|
|
@ -69,3 +55,17 @@ Array [
|
|||
",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Request Command with flags: anything 1`] = `
|
||||
Array [
|
||||
"",
|
||||
" Status Endpoint
|
||||
",
|
||||
" 200 https://example.org/anything
|
||||
",
|
||||
"
|
||||
",
|
||||
"\\"{\\"hello\\": \\"world\\"}\\"
|
||||
",
|
||||
]
|
||||
`;
|
||||
|
|
|
|||
|
|
@ -16,13 +16,8 @@ describe('List Command', () => {
|
|||
|
||||
afterEach(() => jest.restoreAllMocks());
|
||||
|
||||
it('Should list available requests for a given file.', async () => {
|
||||
await ListCommand.run([]);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Should disable formatting when the flag is active.', async () => {
|
||||
await ListCommand.run(['--no-format']);
|
||||
test.each([[], ['--no-format']])('with flags:', async (...args) => {
|
||||
await ListCommand.run(args);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,33 +18,15 @@ describe('Request Command', () => {
|
|||
|
||||
afterEach(() => jest.restoreAllMocks());
|
||||
|
||||
it('Should request the given alias', async () => {
|
||||
await RequestCommand.run(['anything']);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Should show all information available when being verbose', async () => {
|
||||
await RequestCommand.run(['anything', '--verbose']);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Should output the response as json', async () => {
|
||||
await RequestCommand.run(['anything', '--as-json']);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Should output the response as json verboselly', async () => {
|
||||
await RequestCommand.run(['anything', '--as-json', '--verbose']);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Should output an unformatted version', async () => {
|
||||
await RequestCommand.run(['anything', '--no-format']);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('Should output nothing', async () => {
|
||||
await RequestCommand.run(['anything', '--quiet']);
|
||||
test.each([
|
||||
['anything'],
|
||||
['anything', '--verbose'],
|
||||
['anything', '--as-json'],
|
||||
['anything', '--as-json', '--verbose'],
|
||||
['anything', '--no-format'],
|
||||
['anything', '--quiet']
|
||||
])('with flags:', async (...args) => {
|
||||
await RequestCommand.run(args);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
|
|
@ -9,27 +9,28 @@
|
|||
"test": "jest",
|
||||
"test:coverage": "jest --coverage ./src"
|
||||
},
|
||||
"files": ["./src/*"],
|
||||
"dependencies": {
|
||||
"@oclif/command": "^1.4.16",
|
||||
"@oclif/config": "^1.6.13",
|
||||
"@oclif/plugin-help": "^1.2.5",
|
||||
"@oclif/plugin-warn-if-update-available": "^1.3.6",
|
||||
"@oclif/command": "^1.4.30",
|
||||
"@oclif/config": "^1.6.21",
|
||||
"@oclif/plugin-help": "^2.0.0",
|
||||
"@oclif/plugin-warn-if-update-available": "^1.3.9",
|
||||
"cli-color": "^1.1.0",
|
||||
"clui": "^0.3.1",
|
||||
"deepmerge": "^2.1.0",
|
||||
"deepmerge": "^2.1.1",
|
||||
"dotenv": "^5.0.1",
|
||||
"joi": "^13.2.0",
|
||||
"globby": "^8.0.1",
|
||||
"is-plain-object": "^2.0.4",
|
||||
"joi": "^13.3.0",
|
||||
"js-yaml": "^3.11.0",
|
||||
"jsome": "^2.5.0",
|
||||
"request": "^2.85.0",
|
||||
"request": "^2.87.0",
|
||||
"request-promise-native": "^1.0.5",
|
||||
"requireg": "^0.1.6"
|
||||
},
|
||||
"repository": "git@github.com:Seich/Beau.git",
|
||||
"devDependencies": {
|
||||
"jest": "^22.4.0",
|
||||
"jest": "^23.0.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"oclif": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue