Skip to content

Commit f3c7d3f

Browse files
committed
Extract strings tests into separate file
1 parent 8a23242 commit f3c7d3f

File tree

3 files changed

+39
-18
lines changed

3 files changed

+39
-18
lines changed

es/utils/swagger.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* ISC License (ISC)
3-
* Copyright (c) 2018 aeternity developers
3+
* Copyright (c) 2021 aeternity developers
44
*
55
* Permission to use, copy, modify, and/or distribute this software for any
66
* purpose with or without fee is hereby granted, provided that the above
@@ -526,7 +526,5 @@ export {
526526
operation,
527527
expandPath,
528528
assertOne,
529-
snakeToPascal,
530-
pascalToSnake,
531529
traverseKeys
532530
}

test/unit/string.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
})

test/unit/swagger.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* ISC License (ISC)
3-
* Copyright (c) 2018 aeternity developers
3+
* Copyright (c) 2021 aeternity developers
44
*
55
* Permission to use, copy, modify, and/or distribute this software for any
66
* purpose with or without fee is hereby granted, provided that the above
@@ -47,20 +47,6 @@ describe('Swagger', function () {
4747
})
4848
})
4949

50-
describe('converts case', () => {
51-
it('from snake to pascal', () => {
52-
expect(internal.snakeToPascal('foo_bar_baz')).to.equal('fooBarBaz')
53-
expect(internal.snakeToPascal('foo_bar_')).to.equal('fooBar_')
54-
expect(internal.snakeToPascal('_bar_baz')).to.equal('BarBaz')
55-
})
56-
57-
it('from pascal to snake', () => {
58-
expect(internal.pascalToSnake('fooBarBaz')).to.equal('foo_bar_baz')
59-
expect(internal.pascalToSnake('fooBar')).to.equal('foo_bar')
60-
expect(internal.pascalToSnake('BarBaz')).to.equal('_bar_baz')
61-
})
62-
})
63-
6450
it('expands paths', () => {
6551
assert.equal(internal.expandPath('/foo/{bar}/baz/{bop}', { bar: 1, bop: 2, useless: 3 }), '/foo/1/baz/2')
6652
assert.equal(internal.expandPath('unchanged'), 'unchanged')

0 commit comments

Comments
 (0)