Skip to content

Instantly share code, notes, and snippets.

@ikr
Last active August 29, 2015 14:24
Show Gist options
  • Save ikr/996db09f46eae2fed0e5 to your computer and use it in GitHub Desktop.
Save ikr/996db09f46eae2fed0e5 to your computer and use it in GitHub Desktop.
Nested contexts for tests
describe('RedBlackTree', () => {
beforeEach(() => {
// Set-up code
});
it('does this', () => {
// Asserts
});
it('does that', () => {
// Asserts
});
describe('when empty', () => {
beforeEach(() => {
// Set-up code for the "empty" case
});
// it-s with asserts
});
describe('insertion', () => {
// Some set-up with beforeEach
describe('happy case', () => {
// Additional set-up with beforeEach
// Asserts
});
describe('when heavily unbalanced', () => {
// Additional set-up with beforeEach
// Asserts
});
});
// ... and so on
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment