[feat] scoped datasets

This commit is contained in:
Fabio Ivona
2022-09-19 17:45:27 +02:00
parent 12618ff8b3
commit cbee6e76b0
16 changed files with 267 additions and 40 deletions

View File

@ -3,31 +3,31 @@
use Pest\Repositories\DatasetsRepository;
it('show only the names of named datasets in their description', function () {
$descriptions = array_keys(DatasetsRepository::resolve('test description', [
$descriptions = array_keys(DatasetsRepository::resolve([
[
'one' => [1],
'two' => [[2]],
],
]));
], __FILE__));
expect($descriptions[0])->toBe('data set "one"')
->and($descriptions[1])->toBe('data set "two"');
});
it('show the actual dataset of non-named datasets in their description', function () {
$descriptions = array_keys(DatasetsRepository::resolve('test description', [
$descriptions = array_keys(DatasetsRepository::resolve([
[
[1],
[[2]],
],
]));
], __FILE__));
expect($descriptions[0])->toBe('(1)');
expect($descriptions[1])->toBe('(array(2))');
});
it('show only the names of multiple named datasets in their description', function () {
$descriptions = array_keys(DatasetsRepository::resolve('test description', [
$descriptions = array_keys(DatasetsRepository::resolve([
[
'one' => [1],
'two' => [[2]],
@ -36,7 +36,7 @@ it('show only the names of multiple named datasets in their description', functi
'three' => [3],
'four' => [[4]],
],
]));
], __FILE__));
expect($descriptions[0])->toBe('data set "one" / data set "three"');
expect($descriptions[1])->toBe('data set "one" / data set "four"');
@ -45,7 +45,7 @@ it('show only the names of multiple named datasets in their description', functi
});
it('show the actual dataset of multiple non-named datasets in their description', function () {
$descriptions = array_keys(DatasetsRepository::resolve('test description', [
$descriptions = array_keys(DatasetsRepository::resolve([
[
[1],
[[2]],
@ -54,7 +54,7 @@ it('show the actual dataset of multiple non-named datasets in their description'
[3],
[[4]],
],
]));
], __FILE__));
expect($descriptions[0])->toBe('(1) / (3)');
expect($descriptions[1])->toBe('(1) / (array(4))');
@ -63,7 +63,7 @@ it('show the actual dataset of multiple non-named datasets in their description'
});
it('show the correct description for mixed named and not-named datasets', function () {
$descriptions = array_keys(DatasetsRepository::resolve('test description', [
$descriptions = array_keys(DatasetsRepository::resolve([
[
'one' => [1],
[[2]],
@ -72,7 +72,7 @@ it('show the correct description for mixed named and not-named datasets', functi
[3],
'four' => [[4]],
],
]));
], __FILE__));
expect($descriptions[0])->toBe('data set "one" / (3)');
expect($descriptions[1])->toBe('data set "one" / data set "four"');