laravel-dynamodb icon indicating copy to clipboard operation
laravel-dynamodb copied to clipboard

Idea to introduce a new trait that provides assertions for feature tests

Open jkswoods opened this issue 4 years ago • 1 comments

Hey, so I've been writing some feature tests to validate the functionality I've built with the help of this package is working correctly.

While doing so, I noticed the tests often got a bit clunky and could be simplified a bit with the help of some new assertions - I ended up creating a trait called DynamoDbTestAssertions that provides the following methods:

public static function assertDynamoDbHasTable(string $table);
public static function assertDynamoDbMissingTable(string $table);
public static function assertDynamoDbHasItem(string $table, string $key, $keyValue);
public static function assertDynamoDbMissingItem(string $table, string $key, $keyValue);
public static function assertDynamoDbItemEquals(string $table, string $key, $keyValue, $expected);
public static function assertDynamoDbItemNotEquals(string $table, string $key, $keyValue, $expected);

My tests are so much easier to read and write because of this...

What do you think?

jkswoods avatar Aug 18 '21 19:08 jkswoods

Looks very helpful, if you're interested in raising a PR, I'm sure others would also benefit from this

JackPriceBurns avatar Aug 20 '21 09:08 JackPriceBurns