| 
									
										
										
										
											2025-03-10 14:52:50 -05:00
										 |  |  | package nomino | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"testing" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/google/uuid" | 
					
						
							|  |  |  | 	"github.com/stretchr/testify/assert" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func TestNewConf(t *testing.T) { | 
					
						
							|  |  |  | 	c := NewConfig() | 
					
						
							|  |  |  | 	assert.Equal(t, ".txt", c.extension) | 
					
						
							| 
									
										
										
										
											2025-03-13 15:36:30 -05:00
										 |  |  | 	st, _ := c.generator(&c) | 
					
						
							| 
									
										
										
										
											2025-03-10 14:52:50 -05:00
										 |  |  | 	_, parseErr := uuid.Parse(st) | 
					
						
							|  |  |  | 	assert.NoError(t, parseErr) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func TestNewConfWithOpts(t *testing.T) { | 
					
						
							|  |  |  | 	c := NewConfig(WithoutExtension(), WithPrefix("foobar")) | 
					
						
							|  |  |  | 	assert.Equal(t, "", c.extension) | 
					
						
							| 
									
										
										
										
											2025-03-11 16:42:39 -05:00
										 |  |  | 	assert.Equal(t, "foobar", c.prefix) | 
					
						
							| 
									
										
										
										
											2025-03-10 14:52:50 -05:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2025-03-18 09:22:30 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | func TestConfAddOpts(t *testing.T) { | 
					
						
							|  |  |  | 	c := Config{original: "hi"} | 
					
						
							|  |  |  | 	c2 := c.AddOptions(WithOriginalSlug("Hello, my dear"), WithPrefix("yo")) | 
					
						
							|  |  |  | 	assert.Equal(t, "", c.prefix) | 
					
						
							|  |  |  | 	assert.Equal(t, "hi", c.original) | 
					
						
							|  |  |  | 	assert.Equal(t, "hello-my-dear", c2.original) | 
					
						
							|  |  |  | 	assert.Equal(t, "yo", c2.prefix) | 
					
						
							|  |  |  | } |