Skip to content

Adjust testing strategy for fixture values #173

Description

@BioPhoton

The fixtures should reflect the parsing logic and edge cases should be implemented visibly as over write.

Before:

exportfunctionconfig(outputDir='tmp'): CoreConfig{return{persist: { outputDir },// ...}};it('should throw if outputDir is invalid',()=>{constpersistConfigMock=persistConfig({outputDir : ' '});expect(()=>persistConfigSchema.parse(persistConfigMock)).toThrow(`path is invalid`,);});

This is not in sync with the logic like default, validation etc in schemas. A change later already fail in the mock and we have to use visible overwrites for invalid data.

After:

exportfunctionconfig(outputDir='tmp'): CoreConfig{return{persist: persistConfigSchema.parse({ outputDir }),// ...}};it('should throw if outputDir is invalid',()=>{constpersistConfigMock=persistConfig();persistConfigMock.outputDir=' ';expect(()=>persistConfigSchema.parse(persistConfigMock)).toThrow(`path is invalid`,);});

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions