zipkin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From unknown ...@apache.org>
Subject [incubator-zipkin] 02/09: Add unit tests for MiniTimeline/util.js
Date Thu, 09 May 2019 04:52:46 GMT
This is an automated email from the ASF dual-hosted git repository.

(unknown) pushed a commit to branch mini-timeline
in repository https://gitbox.apache.org/repos/asf/incubator-zipkin.git

commit a4fdc5ee3c3b20b5e03f306424cee5f80c70fdbb
Author: tacigar <ig.lhound@gmail.com>
AuthorDate: Wed May 8 19:22:27 2019 +0900

    Add unit tests for MiniTimeline/util.js
---
 .../src/components/MiniTimeline/util.test.js       | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/zipkin-lens/src/components/MiniTimeline/util.test.js b/zipkin-lens/src/components/MiniTimeline/util.test.js
new file mode 100644
index 0000000..3bbcdc3
--- /dev/null
+++ b/zipkin-lens/src/components/MiniTimeline/util.test.js
@@ -0,0 +1,28 @@
+import { getGraphHeight, getGraphLineHeight } from './util';
+
+describe('getGraphHeight', () => {
+  it('should return proper value', () => {
+    expect(getGraphHeight(-1)).toEqual(0);
+    expect(getGraphHeight(0)).toEqual(0);
+    expect(getGraphHeight(1)).toEqual(0);
+    expect(getGraphHeight(2)).toEqual(2 * 5);
+    expect(getGraphHeight(14)).toEqual(14 * 5);
+    expect(getGraphHeight(15)).toEqual(75);
+    expect(getGraphHeight(16)).toEqual(75);
+    expect(getGraphHeight(100)).toEqual(75);
+  });
+});
+
+describe('getGraphLineHeight', () => {
+  it('should return proper value', () => {
+    expect(getGraphLineHeight(-1)).toEqual(0);
+    expect(getGraphLineHeight(0)).toEqual(0);
+    expect(getGraphLineHeight(1)).toEqual(0);
+    expect(getGraphLineHeight(2)).toEqual(5);
+    expect(getGraphLineHeight(14)).toEqual(5);
+    expect(getGraphLineHeight(15)).toEqual(5);
+    expect(getGraphLineHeight(16)).toEqual(75 / 16);
+    expect(getGraphLineHeight(20)).toEqual(75 / 20);
+    expect(getGraphLineHeight(100)).toEqual(1);
+  });
+});


Mime
View raw message