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

Add tests for request with stream #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
6 changes: 2 additions & 4 deletions ROAD_MAP.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# ROADMAP
- Create your on invirte module
- configuration for each plugin
- Informative README stage 2 (english improvement)
- check the library with streaming
- Cdn implementation


- Create your on invirte module
- cancel open group

Options
----
7 changes: 6 additions & 1 deletion server/index.js
Original file line number Diff line number Diff line change
@@ -35,9 +35,14 @@ app.get('/basic', basicResponse)

app.post('/multipart', (req, res) => res.sendStatus(200))

app.get('/stream', (req, res) => {
res.write("USERID,NAME,FBID,ACCOUNT,SUBSCRIPTION,PRICE,STATE,TIMEPERIOD\n")
res.write("23,John Doe,1234,500,SUBSCRIPITON,100,ACTIVE,30\n")
res.end()
})

let server

let server
module.exports = {
init: () => {
server = app.listen(port)
8 changes: 8 additions & 0 deletions test/log/index.spec.js
Original file line number Diff line number Diff line change
@@ -256,4 +256,12 @@ describe('Log plugin', () => {
assert.isTrue(printedData.requestData.data._valuesToMeasure[0].path === absolutePath)
})
})

context('is plugin work well with streams', () => {
it('should print stream request', async () => {
await axios.get(`${BASIC_URL}/stream`)
const printedData = consoleLogSpy.lastCall.args[0]
assert.isTrue(printedData.url === `${BASIC_URL}/stream`)
})
})
})
11 changes: 11 additions & 0 deletions test/pending/index.spec.js
Original file line number Diff line number Diff line change
@@ -84,4 +84,15 @@ describe('Pending plugin', () => {
})
})
})

context('is plugin work well with streams', () => {
it('should save pending stream requests', done => {
axios.get(`${BASIC_URL}/stream`).then(() => {
done()
})
setImmediate(() => {
assert.isTrue(Redel.getPendingRequests().length === 1)
})
})
})
})