(t, emitted, expected)
| 809 | } |
| 810 | |
| 811 | function expectFiles(t, emitted, expected) { |
| 812 | |
| 813 | Object.keys(expected).forEach(function (key) { |
| 814 | var index = findIndex(key); |
| 815 | if (expected[key]) { |
| 816 | t.notEqual(index, -1, 'Should emit ' + key); |
| 817 | } else { |
| 818 | t.equal(index, -1, 'Should not emit ' + key); |
| 819 | } |
| 820 | }); |
| 821 | |
| 822 | function findIndex(file) { |
| 823 | for (var i = 0; i < emitted.length; ++i) { |
| 824 | if (new RegExp(file + '$').test(emitted[i])) { |
| 825 | return i; |
| 826 | } |
| 827 | } |
| 828 | return -1; |
| 829 | } |
| 830 | } |