Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit f482e37

Browse files
finished test-trace
1 parent ce6d020 commit f482e37

2 files changed

Lines changed: 41 additions & 10 deletions

File tree

packages/opencensus-core/scripts/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ const {
1414
TRACE_SYSTEM_TEST_ENCRYPTED_CREDENTIALS_IV
1515
} = process.env;
1616

17-
import { checkInstall } from './check-install';
1817
import { compile } from './compile';
19-
import { encryptCredentials, decryptCredentials } from './credentials';
20-
import { initTestFixtures } from './init-test-fixtures';
21-
import { reportCoverage } from './report-coverage';
2218
import { runTests } from './run-tests';
23-
import { testNonInterference } from './test-non-interference';
2419
import { BUILD_DIRECTORY, existsP, spawnP } from './utils';
2520

2621
// The identifying string in the service account credentials file path.
Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
11
import { Trace } from '../src/trace/trace';
2+
import { Span } from '../src/trace/span';
23

3-
var assert = require('assert');
4+
let assert = require('assert');
45

5-
describe('Trace', function() {
6-
it('should be a Trace instance', function() {
7-
var trace = new Trace();
8-
assert.ok(trace instanceof Trace);
6+
describe('Trace', function () {
7+
let trace = new Trace();
8+
9+
describe('new Trace()', function () {
10+
it('should be a Trace instance', function () {
11+
assert.ok(trace instanceof Trace);
12+
});
13+
});
14+
15+
describe('start()', function () {
16+
it('trace was started', function () {
17+
trace.start()
18+
assert.ok(trace.started);
19+
});
20+
});
21+
22+
describe('startSpan()', function () {
23+
let span = trace.startSpan("spanName", "spanType");
24+
it('should be a Span instance', function () {
25+
assert.ok(span instanceof Span);
26+
});
27+
28+
it('span was started', function () {
29+
assert.ok(span.started);
30+
});
931
});
32+
33+
describe('end()', function () {
34+
it('trace was ended', function () {
35+
trace.end();
36+
assert.ok(trace.ended);
37+
});
38+
});
39+
40+
describe('startSpan() after ended trace', function () {
41+
it('should throws an exception', function () {
42+
assert.throws(() => trace.startSpan("spanName", "spanType"));
43+
});
44+
});
45+
1046
});

0 commit comments

Comments
 (0)