I have static local JSON files, that contains a lot of data, like countries, states, maps data.
{
"CN": {
"value": "CN",
"label": "China"
},
"TW": {
"value": "TW",
"label": "Taiwan, China"
},
"HK": {
"value": "HK",
"label": "Hong Kong"
},
}
Should i write a unit tests to check if have object length of X, and check others properties, labels/values, or this considered as a waste of time and not needed code?
like what i did is the following:
describe('country', () => {
describe('Check object structure', () => {
it('Should return US for US object', () => {
expect(englishCountries.US.value).to.eql('US');
});
it('Should return CN for CN object', () => {
expect(chineseCountries.CN.value).to.eql('CN');
});
});
});
Aucun commentaire:
Enregistrer un commentaire