|
| 1 | +# Copyright 2019-2021 Wingify Software Pvt. Ltd. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +require 'json' |
| 16 | +require_relative '../lib/vwo/utils/utility' |
| 17 | +require 'test/unit' |
| 18 | + |
| 19 | +class UtilityTest < Test::Unit::TestCase |
| 20 | + include VWO::Utils::Utility |
| 21 | + |
| 22 | + def test_convert_to_symbol_hash_with_valid_hash |
| 23 | + hashObject = { 'name': 'CUSTOM' } |
| 24 | + expectation = { name: 'CUSTOM' } |
| 25 | + result = convert_to_symbol_hash(hashObject) |
| 26 | + assert_equal(expectation, result) |
| 27 | + end |
| 28 | + |
| 29 | + def test_convert_to_symbol_hash_with_empty_hash |
| 30 | + hashObject = {} |
| 31 | + expectation = {} |
| 32 | + result = convert_to_symbol_hash(hashObject) |
| 33 | + assert_equal(expectation, result) |
| 34 | + end |
| 35 | + |
| 36 | + def test_convert_to_symbol_hash_with_nil |
| 37 | + hashObject = nil |
| 38 | + expectation = {} |
| 39 | + result = convert_to_symbol_hash(hashObject) |
| 40 | + assert_equal(expectation, result) |
| 41 | + end |
| 42 | + |
| 43 | +end |
0 commit comments