mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 17:57:23 +01:00
Add tests
This commit is contained in:
@ -36,6 +36,13 @@ describe('todo on describe', function () {
|
||||
afterEach(function () {
|
||||
match ($this->name()) {
|
||||
'__pest_evaluable__todo_on_describe__→__todo_block__→__nested_inside_todo_block__→_it_should_not_execute' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_describe__→__todo_block__→__nested_inside_todo_block__→_it_should_set_the_note' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_describe__→__todo_block__→__describe_with_note__→_it_should_apply_the_note_to_a_test_without_a_todo' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_describe__→__todo_block__→__describe_with_note__→_it_should_apply_the_note_to_a_test_with_a_todo' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_describe__→__todo_block__→__describe_with_note__→_it_should_apply_the_note_as_well_as_the_note_from_the_test' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_describe__→__todo_block__→__describe_with_note__→__nested_describe_with_note__→_it_should_apply_all_parent_notes_to_a_test_without_a_todo' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_describe__→__todo_block__→__describe_with_note__→__nested_describe_with_note__→_it_should_apply_all_parent_notes_to_a_test_with_a_todo' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_describe__→__todo_block__→__describe_with_note__→__nested_describe_with_note__→_it_should_apply_all_parent_notes_as_well_as_the_note_from_the_test' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_describe__→__todo_block__→_it_should_not_execute' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_describe__→_it_should_execute' => expect($this->ran)->toBe(true),
|
||||
default => $this->fail('Unexpected test name: '.$this->name()),
|
||||
@ -48,8 +55,47 @@ describe('todo on describe', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
});
|
||||
|
||||
it('should set the note', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
})->todo(note: 'hi');
|
||||
});
|
||||
|
||||
describe('describe with note', function () {
|
||||
it('should apply the note to a test without a todo', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
});
|
||||
|
||||
it('should apply the note to a test with a todo', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
})->todo();
|
||||
|
||||
it('should apply the note as well as the note from the test', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
})->todo(note: 'test note');
|
||||
|
||||
describe('nested describe with note', function () {
|
||||
it('should apply all parent notes to a test without a todo', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
});
|
||||
|
||||
it('should apply all parent notes to a test with a todo', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
})->todo();
|
||||
|
||||
it('should apply all parent notes as well as the note from the test', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
})->todo(note: 'test note');
|
||||
})->todo(note: 'nested describe note');
|
||||
})->todo(note: 'describe note');
|
||||
|
||||
it('should not execute', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
@ -62,6 +108,14 @@ describe('todo on describe', function () {
|
||||
});
|
||||
});
|
||||
|
||||
test('todo on test after describe block', function () {
|
||||
$this->fail();
|
||||
})->todo();
|
||||
|
||||
test('todo with note on test after describe block', function () {
|
||||
$this->fail();
|
||||
})->todo(note: 'test note');
|
||||
|
||||
describe('todo on beforeEach', function () {
|
||||
beforeEach(function () {
|
||||
$this->ran = false;
|
||||
@ -71,6 +125,12 @@ describe('todo on beforeEach', function () {
|
||||
match ($this->name()) {
|
||||
'__pest_evaluable__todo_on_beforeEach__→__todo_block__→__nested_inside_todo_block__→_it_should_not_execute' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_beforeEach__→__todo_block__→_it_should_not_execute' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_beforeEach__→__todo_block__→__describe_with_note__→_it_should_apply_the_note_to_a_test_without_a_todo' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_beforeEach__→__todo_block__→__describe_with_note__→_it_should_apply_the_note_to_a_test_with_a_todo' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_beforeEach__→__todo_block__→__describe_with_note__→_it_should_apply_the_note_as_well_as_the_note_from_the_test' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_beforeEach__→__todo_block__→__describe_with_note__→__nested_describe_with_note__→_it_should_apply_all_parent_notes_to_a_test_without_a_todo' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_beforeEach__→__todo_block__→__describe_with_note__→__nested_describe_with_note__→_it_should_apply_all_parent_notes_to_a_test_with_a_todo' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_beforeEach__→__todo_block__→__describe_with_note__→__nested_describe_with_note__→_it_should_apply_all_parent_notes_as_well_as_the_note_from_the_test' => expect($this->ran)->toBe(false),
|
||||
'__pest_evaluable__todo_on_beforeEach__→_it_should_execute' => expect($this->ran)->toBe(true),
|
||||
default => $this->fail('Unexpected test name: '.$this->name()),
|
||||
};
|
||||
@ -86,6 +146,40 @@ describe('todo on beforeEach', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('describe with note', function () {
|
||||
it('should apply the note to a test without a todo', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
});
|
||||
|
||||
it('should apply the note to a test with a todo', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
})->todo();
|
||||
|
||||
it('should apply the note as well as the note from the test', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
})->todo(note: 'test note');
|
||||
|
||||
describe('nested describe with note', function () {
|
||||
it('should apply all parent notes to a test without a todo', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
});
|
||||
|
||||
it('should apply all parent notes to a test with a todo', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
})->todo();
|
||||
|
||||
it('should apply all parent notes as well as the note from the test', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
})->todo(note: 'test note');
|
||||
})->todo(note: 'nested describe note');
|
||||
})->todo(note: 'describe note');
|
||||
|
||||
it('should not execute', function () {
|
||||
$this->ran = true;
|
||||
$this->fail();
|
||||
@ -97,3 +191,11 @@ describe('todo on beforeEach', function () {
|
||||
expect($this->ran)->toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test('todo on test after describe block with beforeEach', function () {
|
||||
$this->fail();
|
||||
})->todo();
|
||||
|
||||
test('todo with note on test after describe block with beforeEach', function () {
|
||||
$this->fail();
|
||||
})->todo(note: 'test note');
|
||||
|
||||
Reference in New Issue
Block a user