Permalink
Browse files

test: place the "readable" Decoder test first

  • Loading branch information...
1 parent 832c9b7 commit 3c901829097543fa4e8ffea64f386e9104093f13 @TooTallNate committed Nov 27, 2012
Showing with 19 additions and 17 deletions.
  1. +19 −17 test/decoder.js
View
@@ -17,6 +17,22 @@ describe('Decoder', function () {
var genre = 88;
var filename = path.resolve(fixtures, 'pipershut_lo.mp3');
+ it('should emit "readable" events', function (done) {
+ var file = fs.createReadStream(filename);
+ var count = 0;
+ var decoder = new lame.Decoder();
+ decoder.on('readable', function () {
+ count++;
+ var b;
+ while (null != (b = decoder.read()));
+ });
+ decoder.on('finish', function () {
+ assert(count > 0);
+ done();
+ });
+ file.pipe(decoder);
+ });
+
it('should emit a single "format" event', function (done) {
var file = fs.createReadStream(filename);
var decoder = new lame.Decoder();
@@ -47,22 +63,6 @@ describe('Decoder', function () {
decoder.resume();
});
- it('should emit "readable" events', function (done) {
- var file = fs.createReadStream(filename);
- var count = 0;
- var decoder = new lame.Decoder();
- decoder.on('readable', function () {
- count++;
- var b;
- while (null != (b = decoder.read()));
- });
- decoder.on('finish', function () {
- assert(count > 0);
- done();
- });
- file.pipe(decoder);
- });
-
it('should emit a single "id3v1" event', function (done) {
var file = fs.createReadStream(filename);
var decoder = new lame.Decoder();
@@ -94,7 +94,9 @@ describe('Decoder', function () {
done();
});
file.pipe(decoder);
- // "flow" not necessary since ID3v2 tags are at the beginning of the file
+
+ // enable "flow"
+ decoder.resume();
});
});

0 comments on commit 3c90182

Please sign in to comment.