|
| 1 | +/* |
| 2 | + * ISC License (ISC) |
| 3 | + * Copyright (c) 2021 aeternity developers |
| 4 | + * |
| 5 | + * Permission to use, copy, modify, and/or distribute this software for any |
| 6 | + * purpose with or without fee is hereby granted, provided that the above |
| 7 | + * copyright notice and this permission notice appear in all copies. |
| 8 | + * |
| 9 | + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
| 10 | + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
| 11 | + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
| 12 | + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
| 13 | + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
| 14 | + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 15 | + * PERFORMANCE OF THIS SOFTWARE. |
| 16 | + */ |
| 17 | + |
| 18 | +import '../' |
| 19 | +import { describe, it } from 'mocha' |
| 20 | +import { expect } from 'chai' |
| 21 | +import { snakeToPascal, pascalToSnake } from '../../es/utils/string' |
| 22 | + |
| 23 | +describe('Strings', function () { |
| 24 | + describe('converts case', () => { |
| 25 | + it('from snake to pascal', () => { |
| 26 | + expect(snakeToPascal('foo_bar_baz')).to.equal('fooBarBaz') |
| 27 | + expect(snakeToPascal('foo_bar_')).to.equal('fooBar_') |
| 28 | + expect(snakeToPascal('_bar_baz')).to.equal('BarBaz') |
| 29 | + }) |
| 30 | + |
| 31 | + it('from pascal to snake', () => { |
| 32 | + expect(pascalToSnake('fooBarBaz')).to.equal('foo_bar_baz') |
| 33 | + expect(pascalToSnake('fooBar')).to.equal('foo_bar') |
| 34 | + expect(pascalToSnake('BarBaz')).to.equal('_bar_baz') |
| 35 | + }) |
| 36 | + }) |
| 37 | +}) |
0 commit comments