message: fix: fix trace endpoint priority test
diff: * @copyright 2017 Alibaba Group.
  */
  -import * as sinon from 'sinon';
  import { expect } from 'chai';
  import { TraceEndPoint, SKIP_RATE } from '../../../src/';
  @@ -13,11 +12,17 @@ describe('/test/unit/endpoint/TraceEndpoint.test.ts', () => {
  before(function() {
  endpoint = new TraceEndPoint();
  + endpoint.setConfig({
  + priority: true
  + });
  endpoint.initialize();
  });
  it('should collect normal trace by rate', async () => {
  - const stub = sinon.stub(endpoint, 'getRate').returns(100);
  + endpoint.setConfig({
  + rate: 100,
  + priority: true
  + });
  endpoint.processReporter({
  appName: 'test-app',
  @@ -25,8 +30,6 @@ describe('/test/unit/endpoint/TraceEndpoint.test.ts', () => {
  status: 1
  });
  - stub.restore();
  -
  const data = await endpoint.invoke({
  traceId: '123456789'
  });
  @@ -34,8 +37,11 @@ describe('/test/unit/endpoint/TraceEndpoint.test.ts', () => {
  expect(data.length).to.equal(1);
  });
  - it('should collect error or slow trace skip rate', async () => {
  - const stub = sinon.stub(endpoint, 'getRate').returns(-1);
  + it('should collect error or slow trace skip rate when priority is true', async () => {
  + endpoint.setConfig({
  + rate: -1,
  + priority: true
  + });
  endpoint.processReporter({
  appName: 'test-app',
  @@ -43,8 +49,6 @@ describe('/test/unit/endpoint/TraceEndpoint.test.ts', () => {
  status: 2
  });
  - stub.restore();
  -
  const data = await endpoint.invoke({
  traceId: '1234567890'
  });
  @@ -53,4 +57,23 @@ describe('/test/unit/endpoint/TraceEndpoint.test.ts', () => {
  expect(data[0][SKIP_RATE]).to.be.true;
  });
  + it('should not collect error or slow trace was ignored by rate when priority is false', async () => {
  + endpoint.setConfig({
  + rate: -1,
  + priority: false
  + });
  +
  + endpoint.processReporter({
  + appName: 'test-app',
  + traceId: '12345678900',
  + status: 2
  + });
  +
  + const data = await endpoint.invoke({
  + traceId: '12345678900'
  + });
  +
  + expect(data.length).to.equal(0);
  + });
  +
  });
  