-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81eab3b
commit c50f7df
Showing
7 changed files
with
22 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
import { describe, it, assertEqual, assertNotEqual, assertTrue, assertFalse, assertThrows, assertNoDuplicates, runTestFunction } from '../src/testRunner.js'; | ||
|
||
// First test suite | ||
await describe('I am an Example Test Suite', () => { | ||
await describe('I am an Example Test Suite', (description) => { | ||
|
||
it('should pass equality assertion', () => { | ||
assertEqual(1, 1, 'Expected 1 to equal 1'); | ||
}); | ||
}, description); | ||
|
||
it('should pass inequality assertion', () => { | ||
assertNotEqual(1, 2, 'Expected 1 not to equal 2'); | ||
}); | ||
}, description); | ||
|
||
it('should pass true assertion', () => { | ||
assertTrue(true, 'Expected true to be true'); | ||
}); | ||
}, description); | ||
|
||
it('should pass false assertion', () => { | ||
assertFalse(false, 'Expected false to be false'); | ||
}); | ||
}, description); | ||
|
||
it('should pass error assertion', () => { | ||
assertThrows(() => { | ||
throw new Error('An error occurred'); | ||
}, 'An error occurred', 'Expected an error to be thrown'); | ||
}); | ||
}, description); | ||
|
||
it('should deeply compare objects', () => { | ||
const obj1 = { a: 1, b: { c: 2 } }; | ||
const obj2 = { a: 1, b: { c: 2 } }; | ||
assertEqual(obj1, obj2, 'Expected objects to be deeply equal'); | ||
}); | ||
}, description); | ||
|
||
it('should check for duplicates', () => { | ||
const array = ['field1', 'field2'] | ||
assertNoDuplicates(array, 'There should be no duplicates'); | ||
}); | ||
}, description); | ||
|
||
}); | ||
|
||
await runTestFunction(testFunction, { showSummary: false }); | ||
|
||
function testFunction() { | ||
it('First', () => { | ||
assertEqual(1, 2, 'Expected 1 to equal 1'); | ||
}); | ||
assertEqual(1, 1, 'Expected 1 to equal 1'); | ||
}, 'Function: testFunction'); | ||
} |