Parcourir la source

create TopPage test

takeru0001 il y a 5 ans
Parent
commit
ff46ebe4be
1 fichiers modifiés avec 21 ajouts et 0 suppressions
  1. 21 0
      src/test/util/TopPage.test.js

+ 21 - 0
src/test/util/TopPage.test.js

@@ -0,0 +1,21 @@
+const { isTopPage } = require('../../lib/util/path-utils');
+
+
+describe('TopPage Path test', () => {
+  test('Path is only "/"', () => {
+    const result = isTopPage('/');
+    expect(result).toBe(true);
+  });
+  test('Path is not match string ', () => {
+    const result = isTopPage('/test');
+    expect(result).toBe(false);
+  });
+  test('Path is integer', () => {
+    const result = isTopPage(1);
+    expect(result).toBe(false);
+  });
+  test('Path is null', () => {
+    const result = isTopPage(null);
+    expect(result).toBe(false);
+  });
+});