Skip to content

Commit fb955cf

Browse files
committed
added some tests
1 parent b355b42 commit fb955cf

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,34 @@ describe('aspect ratio', () => {
1919
it('using other separator', () => {
2020
should(aspectRatio(1920, 1080, '/')).equal('16/9')
2121
})
22+
23+
it('invalid width', () => {
24+
let error = ''
25+
try {
26+
should(aspectRatio(1920, null, '/')).equal('16/9')
27+
} catch (e) {
28+
error = e.message
29+
}
30+
should(error).equal('Invalid width: null')
31+
})
32+
33+
it('invalid height', () => {
34+
let error = ''
35+
try {
36+
should(aspectRatio(null, 1080, '/')).equal('16/9')
37+
} catch (e) {
38+
error = e.message
39+
}
40+
should(error).equal('Invalid height: null')
41+
})
42+
43+
it('invalid width & height', () => {
44+
let error = ''
45+
try {
46+
should(aspectRatio(null, null)).equal('16/9')
47+
} catch (e) {
48+
error = e.message
49+
}
50+
should(error).equal('Invalid height: null')
51+
})
2252
})

0 commit comments

Comments
 (0)