From 65cb2b19cb275b55c4a388149e65a6686ccdbbab Mon Sep 17 00:00:00 2001 From: Mingkun Ma <55871308+mingkunm@users.noreply.github.com> Date: Tue, 8 Nov 2022 10:59:29 -0800 Subject: [PATCH] Unit test (#83) * feat: Change results number to displayed number Signed-off-by: Mingkun Ma * Add babelrc config Signed-off-by: Mingkun Ma Signed-off-by: Mingkun Ma Co-authored-by: Mingkun Ma --- .babelrc | 18 ++++++++++++++++++ .../common_utils/__tests__/utils.test.ts | 5 +---- 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..e26ee76 --- /dev/null +++ b/.babelrc @@ -0,0 +1,18 @@ +{ + "presets": [ + [ + "@babel/preset-env", + { + "targets": { "node": "10" } + } + ], + "@babel/preset-react", + "@babel/preset-typescript" + ], + "plugins": [ + "@babel/plugin-transform-modules-commonjs", + ["@babel/plugin-transform-runtime", { "regenerator": true }], + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-object-rest-spread" + ] +} diff --git a/public/components/common_utils/__tests__/utils.test.ts b/public/components/common_utils/__tests__/utils.test.ts index fea29f3..38eebf5 100644 --- a/public/components/common_utils/__tests__/utils.test.ts +++ b/public/components/common_utils/__tests__/utils.test.ts @@ -3,10 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -// TODO: Update unit test -const isNameValid = (name) => { - return name.length >= 50 || name.length === 0 ? false : true; -}; +import { isNameValid } from '../utils'; describe('Utils helper functions', () => { it('validates isNameValid function', () => {