jeudi 28 septembre 2017

Jest. Change default export of imported module

I have a file config.js which looks and pretty much this:

import publicConfig from './prod.keys';

const defaultConfig = {
   //...some default config
};

export default publicConfig || defaultConfig;

and prod.keys.js

// SOCIAL API KEYS FOR PRODUCTION
export default null;

Now I wonder if I can test that if someone adds a configuration to prod.keys.js as a default export then config.js file will return that config instead of default one?

Or maybe I shouldn't be testing things like this?

Aucun commentaire:

Enregistrer un commentaire