Skip to content

Commit

Permalink
Fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickjuchli committed Jul 16, 2022
1 parent d4cfe52 commit f4445b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/uploadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ konnte. Seine vielen, im Vergleich zu seinem sonstigen Umfang kläglich dünnen
Beine flimmerten ihm hilflos vor den Augen.`.repeat(2000)

const FILENAME = "file.txt"
const TIMEOUT = 100
const TIMEOUT = 1000

function getReadable(payload = SHORT_TEXT) {
const readable = new Readable()
Expand Down Expand Up @@ -88,8 +88,8 @@ describe("Upload", function() {
})
})

it(`switches correctly between sockets to track timeout during transfer`, async () => {
const readable = getReadable()
it(`switches correctly between sockets to track timeout during transfer`, () => {
this.client.ftp.timeout = TIMEOUT
assert.strictEqual(this.client.ftp.socket.timeout, 0, "before task (control)");
assert.strictEqual(this.client.ftp.dataSocket, undefined, "before task (data)");
this.server.addHandlers({
Expand All @@ -111,7 +111,7 @@ describe("Upload", function() {
assert.strictEqual(this.client.ftp.socket.timeout, TIMEOUT, "did close data connection (control)");
assert.strictEqual(this.client.ftp.dataSocket.timeout, 0, "did close data connection (data)");
}
return this.client.uploadFrom(readable, FILENAME).then(() => {
return this.client.uploadFrom(getReadable(VERY_LONG_TEXT), FILENAME).then(() => {
assert.strictEqual(this.client.ftp.socket.timeout, 0, "after task (control)");
assert.strictEqual(this.client.ftp.dataSocket, undefined, "after task (data)");
})
Expand Down

0 comments on commit f4445b0

Please sign in to comment.