Add test for the warn event when using the deprecated component.json.

This commit is contained in:
André Cruz
2013-04-22 01:41:56 +01:00
parent 5cce1af3d7
commit e78dc4892f
2 changed files with 10 additions and 2 deletions

View File

@@ -398,16 +398,23 @@ describe('Resolver', function () {
.done();
});
it('should fallback to component.json', function (next) {
var resolver = new Resolver('foo');
it('should fallback to component.json (emitting a "warn" event)', function (next) {
var resolver = new Resolver('foo'),
warn;
fs.writeFileSync(path.join(tempDir, 'component.json'), JSON.stringify({ name: 'bar', version: '0.0.0' }));
resolver.on('warn', function (data) {
warn = data;
});
resolver._readJson(tempDir)
.then(function (meta) {
expect(meta).to.be.an('object');
expect(meta.name).to.equal('bar');
expect(meta.version).to.equal('0.0.0');
expect(warn).to.contain('deprecated');
next();
})
.done();