forked from parshap/node-acoustid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
44 lines (39 loc) · 974 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* jshint node:true */
"use strict";
var path = require("path"),
acoustid = require("./"),
test = require("tape"),
assert = require("assert");
var TEST_FILE = path.join(__dirname, "test.mp3"),
KEY = "8XaBELgH";
test("get data", function(t) {
call(null, function(err, results) {
t.ok(results[0]);
t.ok(results[0].recordings);
t.ok(results[0].recordings[0]);
t.ok(results[0].recordings[0].releasegroups);
t.end();
});
});
test("meta parameter", function(t) {
call({
meta: "recordingids",
}, function(err, results) {
t.ok(results[0]);
t.ok(results[0].recordings);
t.ok(results[0].recordings[0]);
t.ok(results[0].recordings[0].id);
t.notOk(results[0].recordings[0].title);
t.end();
});
});
// Call acoustid on test file
function call(options, callback) {
options = options || {};
options.key = KEY;
acoustid(TEST_FILE, options, function(err, results) {
assert.ifError(err);
assert(results);
callback.apply(this, arguments);
});
}