Simple Time Control For Dart Unit Tests

Controlling time in a unit test allows you to test code that depends on the passage of time like Timer or time comparisons. Dart makes it easy as long as you use the Clock package in code that gets dates instead of using DateTime directly. For any code using Clock time can be controlled through the FakeAsync package. Example Time Test Two key things to note in this example test. First that the test is wrapped in the fakeAsync method. Second that the first time clock is used is inside the fakeAsync wrapper. That’s important, if you access the clock [Read on…]

AWS Websocket 403 Using PostToConnect

Using the V2 Golang SDK for AWS and trying to call PostToConnection from a Lambda I was consistently getting this 403 error result: I was trying to make the call from a different stack than the websocket connection was on so I thought that might be the problem. After much research the issue actually turned out to be simpler than that. There is nothing special about the stack that requires extra permission (unless the stages are in different regions, I haven’t done that yet but it looks like there is more work required if you are). The issue for me [Read on…]