What Not to Unit Test

I need to start this by saying that TDD is a very powerful technique that helps.

This is a discussion of the areas not to test.

Don’t fully test a library. Do have a test that the library does what you need.

Don’t build integration tests when you are unsure about the specific implementation ( especially if the setup becomes excessive). Add the tests on the second feature.

When integrating with 3rd party APIs you may get more value instrumenting well and seeing hoe it behaves in production. This is the source of the “don’t mock what you don’t control” rule. Vendors rarely provide an accurate test environment. REPLs are the best way to experiment with them.

If you have complex logic (more than one if statement or a trivial reduce) then write tests for that. They will be easy to write now and will be valuable as things become more complicated.

Useful UI Tool: Storybook

https://storybook.js.org/docs/6.5/react/get-started/why-storybook/

This is a tool that allows you to isolate UI components. The practical benefit is that you can list all of the expected states of a component without having to build the world around it.

I am currently working on displaying data that has no simple way of recreating accurately in environments below production. By using Storybook I can demonstrate what it would look like.

Another benefit is that you can test the component in isolation on a range of devices/browsers. That makes checking a new component much easier.

The Domain Driven Organisation

Larger organisations try to adopt a Domain Driven approach where various parts try to act independently.
This is a good plan.

However independence does not mean ignoring other parts of the business that are consumers of what you produce.

Domain Driven Organisations need clear defined boundaries between the various domains. If the boundaries (contracts between systems) are weakly defined then changes in one place can have an impact in an ideally unrelated system.

Customer Service is Important

Of late I have been having problems with a number of service providers. I try to give feedback to allow them to improve.

Barclays have a problem with their online banking – they sometimes drop people from your payee list. This is only meant to happen after 14 months. They dropped my credit card provider from the list and that gets paid every month. Another entry does not seem to be correct having the wrong reference. This dropping payees is listed as a known issue and I was told it may happen again. The online banking site is a bit of a mess – you can’t delete payees yourself.

Direct Line send out generic letters on payment failures and the staff blame it on an “automated system”. This is not acceptable. If you have generic letters make the effort to have suitable generic messages. Post is slow and the problem may have been resolved by the time the letter reaches you.

After cancelling my policy Direct Line sent me a letter offering me the chance to stop the cancel. The date on the letter was one day before the policy was due to stop and it arrived 5 days after I would have been able to do anything. This is pure waste.

I am also concerned about Amazon. I have a parcel that was due to be delivered yesterday that failed to arrive. According to the form it was out for delivery but failed to arrive and is now delayed by a week.

Gardening 2023

Today I made a start on my greenhouse crops. This time I am trying to propgate tomatos and cucumbers in my greenhouse rather than starting them in the conservatory.

They are in a propgator inside the greenhouse. The greenhouse ranged from 5c to 30c over the last 24 hours. I can’t control this to the recommended 18c.

UK Adopts The Dismal Science

The UK is currently in a mess.

Brexit is clearly a failure. We have a cost of living crisis.

For bizarre technical reasons the amount paid on a mortgage is not counted towards inflation.
This means that in reaction to a rise in inflation (which hit 10.5% in December 2022) the Bank of England have been reacting by raising interest rates.

This is the only lever that they have to get inflation back down to 2%

The problem is that the economic theories that are being used belong to the 1950’s and 1960’s.
The inflation is not caused by an overactive economy lead by borrowing, this time it is caused by unregulated energy price rises and the damage caused by incompetent Truss administration.

Raising interest rates now makes credit cards more expensive at a time where the majority of the population are being stretched by rising costs.

Oban is Amazing

Recently I moved an API integration to use Oban (https://hex.pm/packages/oban).

Previously we had been making API calls to a third party that we need to notify of changes. Our old implementation simple made the call and logged errors. This meant we had to spend time checking logs for possible problems.

After the move to Oban (we use the paid for add-on Oban Web) items needing attention now have a UI.

I have not yet worked out how best to model “wait for an email then retry”.