You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					24 lines
				
				402 B
			
		
		
			
		
	
	
					24 lines
				
				402 B
			| 
								 
											3 years ago
										 
									 | 
							
								'use strict'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const t = require('tap')
							 | 
						||
| 
								 | 
							
								const factory = require('../')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const noop = function () {}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								t.test('issue-63', (t) => {
							 | 
						||
| 
								 | 
							
								  t.plan(2)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  const fmw = factory()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  t.throws(function () {
							 | 
						||
| 
								 | 
							
								    fmw.on('GET', '/foo/:id(a', noop)
							 | 
						||
| 
								 | 
							
								  })
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  try {
							 | 
						||
| 
								 | 
							
								    fmw.on('GET', '/foo/:id(a', noop)
							 | 
						||
| 
								 | 
							
								    t.fail('should fail')
							 | 
						||
| 
								 | 
							
								  } catch (err) {
							 | 
						||
| 
								 | 
							
								    t.equal(err.message, 'Invalid regexp expression in "/foo/:id(a"')
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								})
							 |