-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtests.js
32 lines (30 loc) · 916 Bytes
/
tests.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
Tinytest.add('stacktrace - definition', function (test) {
var isDefined = false;
try {
StackTrace;
isDefined = true;
}
catch (e) {
}
test.isTrue(isDefined, "StackTrace is not defined");
test.isTrue(Package['peerlibrary:stacktrace'].StackTrace, "Package.peerlibrary:stacktrace.StackTrace is not defined");
});
Tinytest.addAsync('stacktrace - stackframes', function (test, onComplete) {
StackTrace.get().then(function (stackframes) {
test.isTrue(_.isArray(stackframes));
onComplete();
}).catch(function (error) {
test.fail(error);
onComplete();
});
});
Tinytest.addAsync('stacktrace - get caller', function callerNameTest(test, onComplete) {
StackTrace.getCaller().then(function (caller) {
test.isTrue(caller);
test.include(caller.functionName, 'callerNameTest');
onComplete();
}).catch(function (error) {
test.fail(error);
onComplete();
});
});