Skip to content
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

ci: use fdp-play #495

Merged
merged 35 commits into from
Sep 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e5844ad
ci: use fdp-play
Cafe137 Mar 6, 2024
33625de
ci: run tests with node 18
Cafe137 Mar 6, 2024
c0fcdab
chore: merge
Cafe137 Sep 16, 2024
cbc0930
ci: use latest fdp-play
Cafe137 Sep 16, 2024
5cd3ccc
ci: use full package name
Cafe137 Sep 16, 2024
4eab219
test: remove stamp from feed print
Cafe137 Sep 16, 2024
1fcc085
test: remove large upload warnings
Cafe137 Sep 16, 2024
3bd5873
fix: remove 0x in bzz address
Cafe137 Sep 16, 2024
754ac0c
fix: remove indices from curl tests
Cafe137 Sep 16, 2024
da34318
fix: pass arg first
Cafe137 Sep 16, 2024
90a5c40
fix: increase test amount
Cafe137 Sep 16, 2024
afaf6bb
fix: fix bad tests
Cafe137 Sep 16, 2024
ff24339
test: add mock stake endpoint
Cafe137 Sep 16, 2024
68b55ff
fix: fix amounts in tests
Cafe137 Sep 16, 2024
389524c
fix: fix tests
Cafe137 Sep 16, 2024
ba91cec
test: make default stamp larger
Cafe137 Sep 16, 2024
e17e541
chore: bump bee-js
Cafe137 Sep 16, 2024
58810f1
ci: trigger
Cafe137 Sep 16, 2024
36ebde5
chore: bump bee-js
Cafe137 Sep 16, 2024
2d98d26
test: add root slash endpoint to mock server
Cafe137 Sep 16, 2024
7b8187e
fix: add missing fields to mock server
Cafe137 Sep 16, 2024
8a54f15
chore: look for patterns instead of indices
Cafe137 Sep 16, 2024
aa32c12
chore: look for patterns instead of indices
Cafe137 Sep 16, 2024
ffc58c8
fix: make chequebook balances strings
Cafe137 Sep 16, 2024
6822e4b
fix: replace stamp with test_stamp for tests
Cafe137 Sep 16, 2024
3f5e248
fix: fix expected values in tests
Cafe137 Sep 16, 2024
dc98043
fix: improve detection of 404
Cafe137 Sep 16, 2024
525679b
fix: adjust expected error messages
Cafe137 Sep 16, 2024
f24fc69
test: remove skip from all tests
Cafe137 Sep 16, 2024
9d9eb71
test: disable tests which may root from bee
Cafe137 Sep 16, 2024
b6ba723
ci: trigger
Cafe137 Sep 16, 2024
68e5274
ci: trigger
Cafe137 Sep 16, 2024
debd0e2
fix: change line order
Cafe137 Sep 16, 2024
58dfb95
fix: change line order
Cafe137 Sep 16, 2024
8a28f67
test: change removed lines order
Cafe137 Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: remove indices from curl tests
Cafe137 committed Sep 16, 2024
commit 754ac0ca61fd87f7579ca9d865b74664b1918b10
48 changes: 30 additions & 18 deletions test/misc/curl.spec.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,57 @@
import { toMatchLinesInOrder } from '../custom-matcher'
import { describeCommand, invokeTestCli } from '../utility'
import { getStampOption } from '../utility/stamp'

expect.extend({
toMatchLinesInOrder,
})

describeCommand('--curl flag', ({ consoleMessages }) => {
it('should print upload command without encryption', async () => {
await invokeTestCli(['upload', 'test/testpage/index.html', '--curl', ...getStampOption()])
expect(consoleMessages[1]).toContain('curl -X POST "http://localhost:1633/bzz?name=index.html" ')
expect(consoleMessages[1]).toContain(`-H "swarm-postage-batch-id: ${getStampOption()[1]}`)
expect(consoleMessages[1]).not.toContain('swarm-encrypt')
expect(consoleMessages).toMatchLinesInOrder([
[
'curl -X POST "http://localhost:1633/bzz?name=index.html" ',
`-H "swarm-postage-batch-id: ${getStampOption()[1]}`,
'-H "swarm-encrypt: true"',
],
])
expect(consoleMessages.every(x => !x.includes('swarm-encrypt'))).toBeTruthy()
})

it('should print upload command with encryption', async () => {
await invokeTestCli(['upload', 'test/testpage/index.html', '--encrypt', '--curl', ...getStampOption()])
expect(consoleMessages[1]).toContain('curl -X POST "http://localhost:1633/bzz?name=index.html" ')
expect(consoleMessages[1]).toContain(`-H "swarm-postage-batch-id: ${getStampOption()[1]}`)
expect(consoleMessages[1]).toContain('-H "swarm-encrypt: true"')
expect(consoleMessages).toMatchLinesInOrder([
[
'curl -X POST "http://localhost:1633/bzz?name=index.html" ',
`-H "swarm-postage-batch-id: ${getStampOption()[1]}`,
'-H "swarm-encrypt: true"',
],
])
})

it('should print file', async () => {
await invokeTestCli(['upload', 'test/testpage/index.html', '--curl', ...getStampOption()])
expect(consoleMessages[1]).toContain('curl -X POST "http://localhost:1633/bzz?name=index.html" ')
expect(consoleMessages[1]).toContain('--data @test/testpage/index.html')
expect(consoleMessages).toMatchLinesInOrder([
['curl -X POST "http://localhost:1633/bzz?name=index.html" ', '--data @test/testpage/index.html'],
])
})

it('should print <buffer> for directories', async () => {
await invokeTestCli(['upload', 'test/testpage/', '--curl', ...getStampOption()])
expect(consoleMessages[2]).toContain('curl -X POST "http://localhost:1633/bzz" ')
expect(consoleMessages[2]).toContain('--data <buffer>')
expect(consoleMessages).toMatchLinesInOrder([['curl -X POST "http://localhost:1633/bzz"', '--data <buffer>']])
})

it('should not print undefined params', async () => {
await invokeTestCli(['upload', 'test/testpage/index.html', '--curl', '--drop-name', ...getStampOption()])
expect(consoleMessages[1]).toContain('curl -X POST "http://localhost:1633/bzz" ')
expect(consoleMessages[1]).toContain('--data @test/testpage/index.html')
expect(consoleMessages).toMatchLinesInOrder([
['curl -X POST "http://localhost:1633/bzz"', '--data @test/testpage/index.html'],
])
})

it('should detect content type', async () => {
await invokeTestCli(['upload', 'test/testpage/index.html', '--curl', ...getStampOption()])
expect(consoleMessages[1]).toContain('-H "content-type: text/html"')
expect(consoleMessages[1]).not.toContain('Content-Type')
expect(consoleMessages).toMatchLinesInOrder([['-H "content-type: text/html"']])
})

it('should use custom content type', async () => {
@@ -49,13 +63,11 @@ describeCommand('--curl flag', ({ consoleMessages }) => {
'--curl',
...getStampOption(),
])
expect(consoleMessages[1]).toContain('-H "content-type: swarm/bzz"')
expect(consoleMessages[1]).not.toContain('Content-Type')
expect(consoleMessages).toMatchLinesInOrder([['-H "content-type: swarm/bzz"']])
})

it('should fall back with undetectable content type', async () => {
await invokeTestCli(['upload', 'test/testpage/swarm.bzz', '--curl', ...getStampOption()])
expect(consoleMessages[1]).toContain('-H "content-type: application/octet-stream"')
expect(consoleMessages[1]).not.toContain('Content-Type')
expect(consoleMessages).toMatchLinesInOrder([['-H "content-type: application/octet-stream"']])
})
})
Loading