-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change AddressInfo empty string values to explicit nulls (#1494)
Changes the behavior of `AddressInfo` to explicitly return `null` instead of an empty string for `AddressInfo.name` and `AddressInfo.logoUri`.
- Loading branch information
1 parent
93f6a75
commit 02bfbbd
Showing
2 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { AddressInfo } from '@/routes/common/entities/address-info.entity'; | ||
import { faker } from '@faker-js/faker'; | ||
|
||
describe('AddressInfo entity', () => { | ||
it('should build an AddressInfo', () => { | ||
const value = faker.finance.ethereumAddress(); | ||
const name = faker.word.words(); | ||
const logoUri = faker.internet.url({ appendSlash: false }); | ||
|
||
const actual = new AddressInfo(value, name, logoUri); | ||
|
||
expect(actual.value).toStrictEqual(value); | ||
expect(actual.name).toStrictEqual(name); | ||
expect(actual.logoUri).toStrictEqual(logoUri); | ||
}); | ||
|
||
it('should build an AddressInfo with null name and null logoUri if not provided', () => { | ||
const value = faker.finance.ethereumAddress(); | ||
|
||
const actual = new AddressInfo(value); | ||
|
||
expect(actual.value).toStrictEqual(value); | ||
expect(actual.name).toStrictEqual(null); | ||
expect(actual.logoUri).toStrictEqual(null); | ||
}); | ||
|
||
it('should build an AddressInfo with null name and null logoUri if they are null', () => { | ||
const value = faker.finance.ethereumAddress(); | ||
|
||
const actual = new AddressInfo(value, null, null); | ||
|
||
expect(actual.value).toStrictEqual(value); | ||
expect(actual.name).toStrictEqual(null); | ||
expect(actual.logoUri).toStrictEqual(null); | ||
}); | ||
|
||
it('should build an AddressInfo with null name and null logoUri if empty strings are passed in', () => { | ||
const value = faker.finance.ethereumAddress(); | ||
const name = ''; | ||
const logoUri = ''; | ||
|
||
const actual = new AddressInfo(value, name, logoUri); | ||
|
||
expect(actual.value).toStrictEqual(value); | ||
expect(actual.name).toStrictEqual(null); | ||
expect(actual.logoUri).toStrictEqual(null); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters