Skip to content
This repository was archived by the owner on Feb 4, 2018. It is now read-only.

Commit a8556b7

Browse files
author
blond
committed
test(valid): should throw if modifier is not valid
1 parent ed87694 commit a8556b7

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

test/throws.test.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

test/valid.test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const test = require('ava');
2+
3+
const BemEntityName = require('../index');
4+
5+
test('should throw error for if entity object is not valid', t => {
6+
t.throws(
7+
() => new BemEntityName({ elem: 'elem' }),
8+
'This is not valid BEM entity: the field `block` is undefined.'
9+
);
10+
});
11+
12+
test('should throw error for if mod object is empty', t => {
13+
t.throws(
14+
() => new BemEntityName({ block: 'block', mod: {} }),
15+
'This is not valid BEM entity: the field `mod.name` is undefined.'
16+
);
17+
});
18+
19+
test('should throw error for if mod name is undefined', t => {
20+
t.throws(
21+
() => new BemEntityName({ block: 'block', mod: { val: 'val' } }),
22+
'This is not valid BEM entity: the field `mod.name` is undefined.'
23+
);
24+
});
25+
26+
test('should throw error for if modName is undefined', t => {
27+
t.throws(
28+
() => new BemEntityName({ block: 'block', modVal: 'val' }),
29+
'This is not valid BEM entity: the field `mod.name` is undefined.'
30+
);
31+
});

0 commit comments

Comments
 (0)