mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-01-27 03:28:30 -06:00
37 lines
954 B
Go
37 lines
954 B
Go
package models
|
|
|
|
import "testing"
|
|
|
|
func TestE2EInfoEncrypted_HasBeenSetUp(t *testing.T) {
|
|
type fields struct {
|
|
Version int
|
|
Nonce []byte
|
|
Content []byte
|
|
AvailableFiles []string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
fields fields
|
|
want bool
|
|
}{
|
|
{"empty", fields{}, false},
|
|
{"version 0", fields{Version: 0}, false},
|
|
{"version 1, empty", fields{Version: 1}, false},
|
|
{"version 0, not empty", fields{Version: 0, Content: []byte("content")}, false},
|
|
{"version 1, not empty", fields{Version: 1, Content: []byte("content")}, true},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
e := &E2EInfoEncrypted{
|
|
Version: tt.fields.Version,
|
|
Nonce: tt.fields.Nonce,
|
|
Content: tt.fields.Content,
|
|
AvailableFiles: tt.fields.AvailableFiles,
|
|
}
|
|
if got := e.HasBeenSetUp(); got != tt.want {
|
|
t.Errorf("HasBeenSetUp() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|