-
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
e1e88bf
commit 70abc51
Showing
4 changed files
with
83 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,97 @@ | ||
import { runWebTestFunction } from "../src/runners/webRunner.js"; | ||
import { describe, it, assertEqual, } from '../src/testRunner.js'; | ||
import { describe, it, assertEqual } from '../src/testRunner.js'; | ||
|
||
// Main test execution | ||
await runWebTestFunction(async () => { | ||
// Sequential setup tests | ||
await setupTests(); | ||
|
||
await runWebTestFunction(testFunction, { | ||
quiet: true, | ||
// Parallel test batches | ||
await Promise.all([ | ||
batchOne(), | ||
batchTwo(), | ||
batchThree() | ||
]); | ||
}, { | ||
quiet: false, | ||
showSummary: true | ||
}); | ||
|
||
function testFunction() { | ||
describe('First Layer', () => { | ||
it('First', () => { | ||
assertEqual(1, 2, 'Expected 1 to equal 1'); | ||
// Sequential setup tests | ||
async function setupTests() { | ||
await describe('Setup Tests', async () => { | ||
await it('should initialize workspace', async () => { | ||
await simulateDelay(100); | ||
assertEqual(true, true, 'Workspace initialized'); | ||
}); | ||
it('Second', () => { | ||
assertEqual(1, 1, 'Expected 1 to equal 1'); | ||
}); | ||
it('Third', () => { | ||
assertEqual(1, 1, 'Expected 1 to equal 1'); | ||
|
||
await it('should setup query system', async () => { | ||
await simulateDelay(150); | ||
assertEqual(true, true, 'Query system ready'); | ||
}); | ||
}); | ||
} | ||
|
||
secondFunction(); | ||
// Test batch 1 | ||
async function batchOne() { | ||
await describe('First Batch', async () => { | ||
await Promise.all([ | ||
it('Test 1.1', async () => { | ||
await simulateDelay(100); | ||
assertEqual(true, true, 'Test 1.1 passed'); | ||
}), | ||
it('Test 1.2', async () => { | ||
await simulateDelay(75); | ||
assertEqual(true, true, 'Test 1.2 passed'); | ||
}), | ||
it('Test 1.3', async () => { | ||
await simulateDelay(50); | ||
assertEqual(false, false, 'Test 1.3 passed'); | ||
}) | ||
]); | ||
}); | ||
} | ||
|
||
function secondFunction() { | ||
describe('Second Layer', () => { | ||
it('First', () => { | ||
assertEqual(1, 1, 'Expected 1 to equal 1'); | ||
}); | ||
it('Second', () => { | ||
assertEqual(1, 1, 'Expected 1 to equal 1'); | ||
}); | ||
it('Third', () => { | ||
assertEqual(1, 1, 'Expected 1 to equal 1'); | ||
}); | ||
thirdFunction(); | ||
// Test batch 2 | ||
async function batchTwo() { | ||
await describe('Second Batch', async () => { | ||
await Promise.all([ | ||
it('Test 2.1', async () => { | ||
await simulateDelay(125); | ||
assertEqual(true, true, 'Test 2.1 passed'); | ||
}), | ||
it('Test 2.2', async () => { | ||
await simulateDelay(150); | ||
assertEqual(1, 2, 'This test should fail'); | ||
}), | ||
it('Test 2.3', async () => { | ||
await simulateDelay(175); | ||
assertEqual(true, true, 'Test 2.3 passed'); | ||
}) | ||
]); | ||
}); | ||
} | ||
|
||
function thirdFunction() { | ||
describe('Third Layer', () => { | ||
it('First', () => { | ||
assertEqual(1, 1, 'Expected 1 to equal 1'); | ||
}); | ||
it('Second', () => { | ||
assertEqual(1, 2, 'Expected 1 to equal 1'); | ||
}); | ||
it('Third', () => { | ||
assertEqual(1, 1, 'Expected 1 to equal 1'); | ||
}); | ||
// Test batch 3 | ||
async function batchThree() { | ||
await describe('Third Batch', async () => { | ||
await Promise.all([ | ||
it('Test 3.1', async () => { | ||
await simulateDelay(200); | ||
assertEqual(true, true, 'Test 3.1 passed'); | ||
}), | ||
it('Test 3.2', async () => { | ||
await simulateDelay(225); | ||
assertEqual(true, true, 'Test 3.2 passed'); | ||
}), | ||
it('Test 3.3', async () => { | ||
await simulateDelay(250); | ||
assertEqual({ a: 1 }, { a: 1 }, 'Test 3.3 passed'); | ||
}) | ||
]); | ||
}); | ||
} | ||
|
||
function simulateDelay(ms) { | ||
return new Promise(resolve => setTimeout(resolve, ms)); | ||
} |