Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Extract utilities for Groonga commands to a separate utility file
- Loading branch information
Showing
3 changed files
with
51 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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 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 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,29 @@ | ||
| var utils = require('../../../test-utils'); | ||
|
|
||
| var successMessage = { | ||
| statusCode: 200, | ||
| body: true | ||
| }; | ||
| exports.successMessage = successMessage; | ||
|
|
||
| function pushSuccessResponse(backend) { | ||
| backend.reserveResponse(function(requestPacket) { | ||
| return utils.createReplyPacket(requestPacket, successMessage); | ||
| }); | ||
| } | ||
| exports.pushSuccessResponse = pushSuccessResponse; | ||
|
|
||
| function groongaResponse(responseMessage) { | ||
| return JSON.parse(responseMessage.body); | ||
| } | ||
| exports.groongaResponse = groongaResponse; | ||
|
|
||
| function groongaResponseHeader(responseMessage) { | ||
| return groongaResponse(responseMessage)[0]; | ||
| }; | ||
| exports.groongaResponseHeader = groongaResponseHeader; | ||
|
|
||
| function groongaResponseBody(responseMessage) { | ||
| return groongaResponse(responseMessage)[1]; | ||
| }; | ||
| exports.groongaResponseBody = groongaResponseBody; |