Skip to content

Commit dbee44f

Browse files
committed
fix: test for 100mb
1 parent e5bfaf3 commit dbee44f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/npm-event.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,20 @@ const register = require('../lib/npm-event')
131131
payload: reqPayload
132132
})
133133
t.true((payloadSize > 1024 * 1024 * 1), 'payload is bigger then 1MB')
134-
t.true((payloadSize < 1024 * 1024 * 25), 'payload is smaller then 25MB')
134+
t.true((payloadSize < 1024 * 1024 * 100), 'payload is smaller then 100MB')
135135
t.is(statusCode, 202, 'statusCode')
136136
t.end()
137137
})
138138

139139
tap.test('does not accept packages that are bigger then 25MB', async (t) => {
140-
const bigBody = Buffer.alloc(1024 * 1024 * 5).toString()
140+
const bigBody = Buffer.alloc(1024 * 1024 * 5 * 4).toString()
141141
const reqPayload = JSON.stringify({
142142
payload: {
143143
body: bigBody
144144
}
145145
})
146146
// Because of the JSON.stringify() the payload with the 5MB Buffer actually
147-
// has a size of ~30MB
147+
// has a size of ~30MB * 4 ~= 120MB
148148
const payloadSize = reqPayload.length
149149

150150
server.register({
@@ -172,7 +172,7 @@ const register = require('../lib/npm-event')
172172
payload: reqPayload
173173
})
174174

175-
t.true((payloadSize > 1024 * 1024 * 25), 'payload is bigger then 25MB')
175+
t.true((payloadSize > 1024 * 1024 * 100), 'payload is bigger then 100MB')
176176
t.is(statusCode, 413, 'statusCode')
177177
t.end()
178178
})

0 commit comments

Comments
 (0)