]> gerrit.simantics Code Review - simantics/district.git/blob - test/toolong.js
Hide "enabled" column for non-component type tech type tables
[simantics/district.git] / test / toolong.js
1 var path = require('path')
2 var test = require('tap').test
3 var writeStream = require('../index.js')
4
5 function repeat (times, string) {
6   var output = ''
7   for (var ii = 0; ii < times; ++ii) {
8     output += string
9   }
10   return output
11 }
12
13 var target = path.resolve(__dirname, repeat(1000, 'test'))
14
15 test('name too long', function (t) {
16   t.plan(2)
17   var stream = writeStream(target)
18   var hadError = false
19   stream.on('error', function (er) {
20     if (!hadError) {
21       t.is(er.code, 'ENAMETOOLONG', target.length + ' character name results in ENAMETOOLONG')
22       hadError = true
23     }
24   })
25   stream.on('close', function () {
26     t.ok(hadError, 'got error before close')
27   })
28   stream.end()
29 })