@@ -9,8 +9,8 @@ describe("Symmetric Encryption", function () {
9
9
it ( "Round trip binary encryption [symmetric, no signature]" , async function ( ) {
10
10
await fc . assert (
11
11
fc . asyncProperty (
12
- fc . string ( ) ,
13
- fc . string ( ) ,
12
+ fc . string ( { minLength : 1 } ) ,
13
+ fc . string ( { minLength : 1 } ) ,
14
14
fc . uint8Array ( { minLength : 1 } ) ,
15
15
fc . uint8Array ( { min : 1 , minLength : 32 , maxLength : 32 } ) ,
16
16
async ( pubSubTopic , contentTopic , payload , symKey ) => {
@@ -40,8 +40,8 @@ describe("Symmetric Encryption", function () {
40
40
it ( "Round trip binary encryption [symmetric, signature]" , async function ( ) {
41
41
await fc . assert (
42
42
fc . asyncProperty (
43
- fc . string ( ) ,
44
- fc . string ( ) ,
43
+ fc . string ( { minLength : 1 } ) ,
44
+ fc . string ( { minLength : 1 } ) ,
45
45
fc . uint8Array ( { minLength : 1 } ) ,
46
46
fc . uint8Array ( { min : 1 , minLength : 32 , maxLength : 32 } ) ,
47
47
fc . uint8Array ( { min : 1 , minLength : 32 , maxLength : 32 } ) ,
@@ -75,8 +75,8 @@ describe("Symmetric Encryption", function () {
75
75
it ( "Check meta is set [symmetric]" , async function ( ) {
76
76
await fc . assert (
77
77
fc . asyncProperty (
78
- fc . string ( ) ,
79
- fc . string ( ) ,
78
+ fc . string ( { minLength : 1 } ) ,
79
+ fc . string ( { minLength : 1 } ) ,
80
80
fc . uint8Array ( { minLength : 1 } ) ,
81
81
fc . uint8Array ( { min : 1 , minLength : 32 , maxLength : 32 } ) ,
82
82
async ( pubSubTopic , contentTopic , payload , symKey ) => {
@@ -118,3 +118,37 @@ describe("Symmetric Encryption", function () {
118
118
) ;
119
119
} ) ;
120
120
} ) ;
121
+
122
+ describe ( "Ensures content topic is defined" , ( ) => {
123
+ it ( "Encoder throws on undefined content topic" , ( ) => {
124
+ const wrapper = function ( ) : void {
125
+ createEncoder ( {
126
+ contentTopic : undefined as unknown as string ,
127
+ symKey : new Uint8Array ( ) ,
128
+ } ) ;
129
+ } ;
130
+
131
+ expect ( wrapper ) . to . throw ( "Content topic must be specified" ) ;
132
+ } ) ;
133
+ it ( "Encoder throws on empty string content topic" , ( ) => {
134
+ const wrapper = function ( ) : void {
135
+ createEncoder ( { contentTopic : "" , symKey : new Uint8Array ( ) } ) ;
136
+ } ;
137
+
138
+ expect ( wrapper ) . to . throw ( "Content topic must be specified" ) ;
139
+ } ) ;
140
+ it ( "Decoder throws on undefined content topic" , ( ) => {
141
+ const wrapper = function ( ) : void {
142
+ createDecoder ( undefined as unknown as string , new Uint8Array ( ) ) ;
143
+ } ;
144
+
145
+ expect ( wrapper ) . to . throw ( "Content topic must be specified" ) ;
146
+ } ) ;
147
+ it ( "Decoder throws on empty string content topic" , ( ) => {
148
+ const wrapper = function ( ) : void {
149
+ createDecoder ( "" , new Uint8Array ( ) ) ;
150
+ } ;
151
+
152
+ expect ( wrapper ) . to . throw ( "Content topic must be specified" ) ;
153
+ } ) ;
154
+ } ) ;
0 commit comments