baopham / laravel-dynamodb

Eloquent syntax for DynamoDB
https://packagist.org/packages/baopham/dynamodb
MIT License
489 stars 128 forks source link

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

Open jkswoods opened 3 years ago

jkswoods commented 3 years ago

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?

JackPriceBurns commented 3 years ago

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