StackTraceAnalyzer.spec.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { assert } from 'chai';
  2. import { StackTraceAnalyzer } from '../../../../src/analyzers/stack-trace-analyzer/StackTraceAnalyzer';
  3. describe('StackTraceAnalyzer', () => {
  4. describe('getLimitIndex (blockScopeBodyLength: number): number', () => {
  5. let limitIndex: number;
  6. describe('Variant #1: length - 10000', () => {
  7. const blockScopeBodyLength: number = 10000;
  8. const expectedLimitIndex: number = 44;
  9. before(() => {
  10. limitIndex = StackTraceAnalyzer.getLimitIndex(blockScopeBodyLength);
  11. });
  12. it('should return correct limit index based on block scope body length', () => {
  13. assert.equal(limitIndex, expectedLimitIndex);
  14. });
  15. });
  16. describe('Variant #2: length - 1000', () => {
  17. const blockScopeBodyLength: number = 1000;
  18. const expectedLimitIndex: number = 26;
  19. before(() => {
  20. limitIndex = StackTraceAnalyzer.getLimitIndex(blockScopeBodyLength);
  21. });
  22. it('should return correct limit index based on block scope body length', () => {
  23. assert.equal(limitIndex, expectedLimitIndex);
  24. });
  25. });
  26. describe('Variant #3: length - 25', () => {
  27. const blockScopeBodyLength: number = 25;
  28. const expectedLimitIndex: number = 24;
  29. before(() => {
  30. limitIndex = StackTraceAnalyzer.getLimitIndex(blockScopeBodyLength);
  31. });
  32. it('should return correct limit index based on block scope body length', () => {
  33. assert.equal(limitIndex, expectedLimitIndex);
  34. });
  35. });
  36. describe('Variant #4: length - 5', () => {
  37. const blockScopeBodyLength: number = 5;
  38. const expectedLimitIndex: number = 4;
  39. before(() => {
  40. limitIndex = StackTraceAnalyzer.getLimitIndex(blockScopeBodyLength);
  41. });
  42. it('should return correct limit index based on block scope body length', () => {
  43. assert.equal(limitIndex, expectedLimitIndex);
  44. });
  45. });
  46. });
  47. });