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

Commit 46f6271

Browse files
committed
Cover scope name
1 parent 03d4ca3 commit 46f6271

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Maker {
2929
if (typeof name !== 'string') {
3030
throw new Error('Name of the scope should be string!')
3131
}
32-
if (name.indexOf('/') !== -1) {
32+
if (name.length === 0 || name.indexOf('/') !== -1) {
3333
throw new Error('Name of the scope should be a word')
3434
}
3535

lib/index.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ test('Fail for wrong scope name', t => {
207207
r.scope(null, () => {})
208208
})
209209
})
210+
t.throws(() => {
211+
createRest(r => {
212+
r.scope('/', () => {})
213+
})
214+
})
210215
})
211216

212217
test('Fail if passed deep path to method', t => {

0 commit comments

Comments
 (0)