Repository navigation
test(sidebar): e2e test for native sidebar #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,786
−266
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5b16cab
fix(sidebar): show request names containing ":" or "}" in full
Gibin-bruno a6e8baa
test(VSCODE-271): native sidebar e2e tests
Gibin-bruno a68ab8b
test(VSCODE-271): validate curl params
Gibin-bruno a49ea20
test(VSCODE-271): avoid test delays
Gibin-bruno 15b40bf
test(VSCODE-271): avoid delays in edge cases
Gibin-bruno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { describe, test, expect, vi } from 'vitest'; | ||
|
|
||
| vi.mock('vscode', () => ({})); | ||
|
|
||
| const { parseBruFileMeta, parseFileMeta } = await import('./collection'); | ||
|
|
||
| const bru = (metaLines: string[], eol = '\n') => | ||
| ['meta {', ...metaLines.map((line) => ` ${line}`), '}', '', 'get {', ' url: https://example.com/{id}', '}', ''].join(eol); | ||
|
|
||
| const yml = (name: string) => | ||
| ['info:', ` name: ${name}`, ' type: http', ' seq: 4', 'http:', ' method: GET', ' url: https://example.com', ''].join('\n'); | ||
|
|
||
| describe('parseBruFileMeta reads request names in full (#215)', () => { | ||
| test('keeps a plain name, numeric seq, type and method', () => { | ||
| const meta = parseBruFileMeta(bru(['name: Get users', 'type: http', 'seq: 3'])); | ||
| expect(meta).toMatchObject({ name: 'Get users', type: 'http-request', seq: 3, tags: [] }); | ||
| expect((meta?.request as { method: string }).method).toBe('get'); | ||
| }); | ||
|
|
||
| test('keeps colons after the first one in the name', () => { | ||
| const meta = parseBruFileMeta(bru(['name: user/:username/sub/path', 'type: http', 'seq: 1'])); | ||
| expect(meta?.name).toBe('user/:username/sub/path'); | ||
| }); | ||
|
|
||
| test('keeps a closing brace inside the name', () => { | ||
| const meta = parseBruFileMeta(bru(['name: user/{username}/sub/path', 'type: http', 'seq: 2'])); | ||
| expect(meta?.name).toBe('user/{username}/sub/path'); | ||
| expect(meta?.seq).toBe(2); | ||
| }); | ||
|
|
||
| test('handles CRLF line endings', () => { | ||
| const meta = parseBruFileMeta(bru(['name: user/{username}/:id', 'type: graphql', 'seq: 7'], '\r\n')); | ||
| expect(meta).toMatchObject({ name: 'user/{username}/:id', type: 'graphql-request', seq: 7 }); | ||
| }); | ||
|
|
||
| test('skips a tags array without losing the keys after it', () => { | ||
| const meta = parseBruFileMeta(bru(['name: Tagged', 'type: http', 'tags: [', ' smoke', ' regression', ']', 'seq: 5'])); | ||
| expect(meta).toMatchObject({ name: 'Tagged', type: 'http-request', seq: 5, tags: [] }); | ||
| }); | ||
|
|
||
| test('skips an inline tags array', () => { | ||
| const meta = parseBruFileMeta(bru(['name: Tagged', 'tags: [smoke]', 'seq: 6'])); | ||
| expect(meta).toMatchObject({ name: 'Tagged', seq: 6 }); | ||
| }); | ||
|
|
||
| test('returns null when there is no meta block', () => { | ||
| expect(parseBruFileMeta('get {\n url: https://example.com\n}\n')).toBeNull(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('parseFileMeta for yml reads the same names in full', () => { | ||
| test.each(['Get users', 'user/:username/sub/path', 'user/{username}/sub/path'])('%s', (name) => { | ||
| const meta = parseFileMeta(yml(name), 'yml'); | ||
| expect(meta).toMatchObject({ name, type: 'http-request', seq: 4 }); | ||
| expect((meta?.request as { method: string }).method).toBe('get'); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| { | ||
| "name": "br-collection", | ||
| "version": "1", | ||
| "items": [ | ||
| { | ||
| "type": "folder", | ||
| "name": "br-f1", | ||
| "items": [ | ||
| { | ||
| "type": "http", | ||
| "name": "br-f1-r1", | ||
| "seq": 1, | ||
| "request": { | ||
| "url": "http://127.0.0.1:8081/api/echo/json", | ||
| "method": "POST", | ||
| "headers": [], | ||
| "params": [], | ||
| "body": { | ||
| "mode": "none" | ||
| }, | ||
| "auth": { | ||
| "mode": "none" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "type": "folder", | ||
| "name": "br-f2", | ||
| "items": [ | ||
| { | ||
| "type": "http", | ||
| "name": "br-f2-r1", | ||
| "seq": 1, | ||
| "request": { | ||
| "url": "http://127.0.0.1:8081/api/echo/json", | ||
| "method": "POST", | ||
| "headers": [], | ||
| "params": [], | ||
| "body": { | ||
| "mode": "none" | ||
| }, | ||
| "auth": { | ||
| "mode": "none" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "type": "http", | ||
| "name": "br-r1", | ||
| "seq": 1, | ||
| "request": { | ||
| "url": "http://127.0.0.1:8081/ping", | ||
| "method": "GET", | ||
| "headers": [], | ||
| "params": [], | ||
| "body": { | ||
| "mode": "none" | ||
| }, | ||
| "auth": { | ||
| "mode": "none" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "type": "http", | ||
| "name": "br-r2", | ||
| "seq": 2, | ||
| "request": { | ||
| "url": "http://127.0.0.1:8081/api/echo/json", | ||
| "method": "POST", | ||
| "headers": [], | ||
| "params": [], | ||
| "body": { | ||
| "mode": "none" | ||
| }, | ||
| "auth": { | ||
| "mode": "none" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.