func TestCreateServer(t *testing.T) {
	f := Flags{
		HTTPSPort: 443,
	}
	ctx := context.Background()
	log := logtest.DiscardLogger
	db := new(db.Database)
	wantVersion := "9d2ffad8e5e5383569d37ec381147f2d"
	staticFS := new(fstest.MapFS)
	dummyFile := new(fstest.MapFile)
	e := EmbeddedData{
		Version:    []byte(wantVersion + "\n"),
		Words:      []byte("apple\nbanana\ncarrot"),
		StaticFS:   staticFS,
		TemplateFS: fstest.MapFS{"file": dummyFile},
	}
	s, err := f.CreateServer(ctx, log, db, e)
	switch {
	case err != nil:
		t.Errorf("unwanted error: %v", err)
	case s == nil:
		t.Error("nil server created")
	case wantVersion != s.Config.Version:
		t.Errorf("config versions not equal:\nwanted: '%v'\ngot:    '%v'", wantVersion, s.Config.Version)
	}
}
// TestCreateServer mainly checks the happy path, making sure defaults defined in config.go are valid.
TestCreateServer mainly checks the happy path, making sure defaults defined in config.go are valid.
// TestCreateServer mainly checks the happy path making sure defaults defined in config . go are valid .
func TestCreateServer(t *testing.T) {
	f := Flags{
		HTTPSPort: 443,
	}
	ctx := context.Background()
	log := logtest.DiscardLogger
	db := new(db.Database)
	wantVersion := "9d2ffad8e5e5383569d37ec381147f2d"
	staticFS := new(fstest.MapFS)
	dummyFile := new(fstest.MapFile)
	e := EmbeddedData{
		Version:    []byte(wantVersion + "\n"),
		Words:      []byte("apple\nbanana\ncarrot"),
		StaticFS:   staticFS,
		TemplateFS: fstest.MapFS{"file": dummyFile},
	}
	s, err := f.CreateServer(ctx, log, db, e)
	switch {
	case err != nil:
		t.Errorf("unwanted error: %v", err)
	case s == nil:
		t.Error("nil server created")
	case wantVersion != s.Config.Version:
		t.Errorf("config versions not equal:\nwanted: '%v'\ngot:    '%v'", wantVersion, s.Config.Version)
	}
}
func TestCreateServer ( t * testing . T ) { f := Flags { HTTPSPort : 443 , } ctx := context . Background ( ) log := logtest . DiscardLogger db := new ( db . Database ) wantVersion := " " staticFS := new ( fstest . MapFS ) dummyFile := new ( fstest . MapFile ) e := EmbeddedData { Version : [ ] byte ( wantVersion + " \n " ) , Words : [ ] byte ( " \n \n " ) , StaticFS : staticFS , TemplateFS : fstest . MapFS { " " : dummyFile } , } s , err := f . CreateServer ( ctx , log , db , e ) switch { case err != nil : t . Errorf ( " " , err ) case s == nil : t . Error ( " " ) case wantVersion != s . Config . Version : t . Errorf ( " \n \n " , wantVersion , s . Config . Version ) } }
TestCreateServer mainly checks the happy path, making sure defaults defined in config.go are valid.
TestCreateServer mainly checks the happy path making sure defaults defined in config . go are valid .