Complete Json PostgreSQL tests

This commit is contained in:
2025-04-23 22:37:36 -04:00
parent 46b079b237
commit f9326c272a
6 changed files with 392 additions and 181 deletions

View File

@@ -78,20 +78,14 @@ describe('::jsonArray()', function () {
describe('::outputJsonArray()', function () {
test('outputs non-empty array when data found', function () {
ob_clean();
ob_start();
$this->clearBuffer();
Custom::outputJsonArray(Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE data->>'sub' IS NOT NULL", []);
$json = ob_get_contents();
ob_end_clean();
expect($json)->toContain('[{', '},{', '}]');
expect($this->getBufferContents())->toContain('[{', '},{', '}]');
});
test('outputs empty array when no data found', function () {
ob_clean();
ob_start();
$this->clearBuffer();
Custom::outputJsonArray(Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE data->>'nothing' = '7'", []);
$json = ob_get_contents();
ob_end_clean();
expect($json)->toBe('[]');
expect($this->getBufferContents())->toBe('[]');
});
});