Skip to content

Commit 73f2acf

Browse files
author
Victor Wiebe
committed
fix: comments based on review
1 parent b825522 commit 73f2acf

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/utils/__tests__/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ describe('serialize and unserialize', () => {
3434
});
3535
});
3636

37-
describe('check string length', () => {
37+
describe('checkStringLength', () => {
3838
const testVariableType = 'myVar';
3939

40-
test('checkStringLength used on a non empty string, catches error above the default 32 characters', () => {
40+
test('throws an error when the string length exceeds the 32 character default', () => {
4141
try {
4242
checkStringLength('0123456789012345678901234567890123456789', testVariableType);
4343
} catch (error) {
@@ -50,7 +50,7 @@ describe('check string length', () => {
5050
}
5151
});
5252

53-
test('checkStringLength used on an empty string, catches error due to not meeting custom requirement of 1 - 32 characters', () => {
53+
test('throws an error when the string length is lower than the supplied minimum', () => {
5454
try {
5555
checkStringLength('', testVariableType, { minLength: 1, maxLength: 32 });
5656
} catch (error) {
@@ -63,7 +63,7 @@ describe('check string length', () => {
6363
}
6464
});
6565

66-
test('checkStringLength used on a 6 character string, catches error due to not meeting custom requirement of 1 - 5 characters', () => {
66+
test('throws an error when the string length is higher than the supplied maximum', () => {
6767
try {
6868
checkStringLength('0123456', testVariableType, { minLength: 1, maxLength: 5 });
6969
} catch (error) {

src/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export function areSameAddress(a: string, b: string) {
5252

5353
/**
5454
* Check the length of a given string to ensure it meets correct bounds
55+
*
5556
* @param value - the string itself
5657
* @param variableName - the name of the variable associated to the string itself
5758
* @param opts - optional min and max length of the string. Defaults to a minimum of 0 (empty string) and a maximum of 32 characters

0 commit comments

Comments
 (0)