mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
* first action! (#1)
This commit is contained in:
parent
8deacc95b1
commit
ace1e6a69a
3750 changed files with 1155519 additions and 0 deletions
55
node_modules/JSONStream/test/header_footer.js
generated
vendored
Normal file
55
node_modules/JSONStream/test/header_footer.js
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
|
||||
|
||||
var fs = require ('fs')
|
||||
, join = require('path').join
|
||||
, file = join(__dirname, 'fixtures','header_footer.json')
|
||||
, JSONStream = require('../')
|
||||
, it = require('it-is')
|
||||
|
||||
var expected = JSON.parse(fs.readFileSync(file))
|
||||
, parser = JSONStream.parse(['rows', /\d+/ /*, 'value'*/])
|
||||
, called = 0
|
||||
, headerCalled = 0
|
||||
, footerCalled = 0
|
||||
, ended = false
|
||||
, parsed = []
|
||||
|
||||
fs.createReadStream(file).pipe(parser)
|
||||
|
||||
parser.on('header', function (data) {
|
||||
headerCalled ++
|
||||
it(data).deepEqual({
|
||||
total_rows: 129,
|
||||
offset: 0
|
||||
})
|
||||
})
|
||||
|
||||
parser.on('footer', function (data) {
|
||||
footerCalled ++
|
||||
it(data).deepEqual({
|
||||
foo: { bar: 'baz' }
|
||||
})
|
||||
})
|
||||
|
||||
parser.on('data', function (data) {
|
||||
called ++
|
||||
it.has({
|
||||
id: it.typeof('string'),
|
||||
value: {rev: it.typeof('string')},
|
||||
key:it.typeof('string')
|
||||
})
|
||||
it(headerCalled).equal(1)
|
||||
parsed.push(data)
|
||||
})
|
||||
|
||||
parser.on('end', function () {
|
||||
ended = true
|
||||
})
|
||||
|
||||
process.on('exit', function () {
|
||||
it(called).equal(expected.rows.length)
|
||||
it(headerCalled).equal(1)
|
||||
it(footerCalled).equal(1)
|
||||
it(parsed).deepEqual(expected.rows)
|
||||
console.error('PASSED')
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue