-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix ctx.RAL_MOCK is null when RAL_MOCK is not set
- Loading branch information
Showing
2 changed files
with
33 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
/** | ||
* @file node-ral | ||
* @author [email protected] | ||
* http://fis.baidu.com/ | ||
|
@@ -205,4 +209,31 @@ describe('mock', function () { | |
}); | ||
}); | ||
|
||
|
||
it.only('should dont mock anything when RAL_MOCK is null', function (done) { | ||
delete process.env.RAL_MOCK; | ||
ral.init({ | ||
confDir: path.join(__dirname, './ral/config'), | ||
mockDir: path.join(__dirname, './ral/mock'), | ||
logger: { | ||
log_path: path.join(__dirname, '../logs'), | ||
app: 'yog-ral' | ||
}, | ||
currentIDC: 'tc' | ||
}); | ||
// should degrade since POST_QS_SERV's enableMock=true | ||
var req = ral('POST_QS_SERV', { | ||
data: { | ||
msg: 'hi', | ||
name: '何方石' | ||
} | ||
}); | ||
req.on('data', function (data) { | ||
done(); | ||
}); | ||
req.on('error', function (err) { | ||
err.message.should.eql('mock fatal hit'); | ||
done(); | ||
}); | ||
}); | ||
}); |