Skip to content

Commit 041d7fe

Browse files
committed
Merge pull request #10 from Sobesednik/feature/zoroaster
Zoroaster tests
2 parents 8bb3694 + 0ee8331 commit 041d7fe

File tree

4 files changed

+319
-236
lines changed

4 files changed

+319
-236
lines changed

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "A Node.js interface to exiftool command-line application.",
55
"main": "src/index.js",
66
"scripts": {
7-
"coverage": "istanbul cover _mocha test/spec -r test/require",
8-
"test": "mocha test/spec -r test/require"
7+
"test": "zoroaster test/spec",
8+
"test-watch": "zoroaster test/spec --watch"
99
},
1010
"repository": {
1111
"type": "git",
@@ -24,11 +24,8 @@
2424
},
2525
"homepage": "https://github.com/Sobesednik/node-exiftool#readme",
2626
"devDependencies": {
27-
"chai": "3.5.0",
28-
"chai-as-promised": "5.3.0",
2927
"dist-exiftool": "10.25.0",
30-
"istanbul": "0.4.3",
31-
"mocha": "2.4.5"
28+
"zoroaster": "^0.1.3"
3229
},
3330
"dependencies": {
3431
"stream-snitch": "0.0.3"

test/require.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/spec/begin-ready-snitch.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
const assert = require('assert')
2+
const Readable = require('stream').Readable
3+
const BeginReadySnitch = require('../../src/begin-ready-snitch')
4+
5+
const commandNumber = 376080
6+
7+
const data = `
8+
[{
9+
"SourceFile": "test/fixtures/CANON/IMG_9857.JPG",
10+
"ExifToolVersion": 10.25,
11+
"FileName": "IMG_9857.JPG",
12+
"Directory": "test/fixtures/CANON",
13+
"FileSize": "51 kB",
14+
"FileModifyDate": "2016:05:16 00:25:40+01:00",
15+
"FileAccessDate": "2016:11:26 01:20:48+00:00",
16+
"FileInodeChangeDate": "2016:05:16 00:25:40+01:00",
17+
"FilePermissions": "rw-r--r--",
18+
"FileType": "JPEG",
19+
"FileTypeExtension": "jpg",
20+
"MIMEType": "image/jpeg",
21+
"XMPToolkit": "Image::ExifTool 10.11",
22+
"CreatorWorkURL": "https://sobesednik.media",
23+
"Scene": "011200",
24+
"Creator": "Anton",
25+
"ImageWidth": 500,
26+
"ImageHeight": 333,
27+
"EncodingProcess": "Baseline DCT, Huffman coding",
28+
"BitsPerSample": 8,
29+
"ColorComponents": 3,
30+
"YCbCrSubSampling": "YCbCr4:2:0 (2 2)",
31+
"ImageSize": "500x333",
32+
"Megapixels": 0.167
33+
}]
34+
`
35+
.trim()
36+
37+
const s = `
38+
{begin${commandNumber}}
39+
${data}
40+
{ready${commandNumber}}
41+
`
42+
.trim()
43+
44+
module.exports = {
45+
'emits event on data': () => {
46+
const rs = Readable()
47+
rs._read = () => {
48+
rs.push(s)
49+
rs.push(null)
50+
}
51+
const brs = new BeginReadySnitch(rs)
52+
return new Promise(resolve => brs.on('data', resolve))
53+
.then((res) => {
54+
assert(res.commandNumber === commandNumber)
55+
assert(res.data === data)
56+
})
57+
},
58+
}

0 commit comments

Comments
 (0)