Skip to content

Commit

Permalink
Remove awaiting from testResult in evaluateTest
Browse files Browse the repository at this point in the history
Co-authored-by: terryzfeng <terryzfeng@users.noreply.github.com>
  • Loading branch information
Kizjkre and terryzfeng committed Jul 16, 2024
1 parent 8aaf01d commit ef0cb6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/tests/playwright/pages/realtime-sine.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
})());

evaluateTest(async testResult => {
const bufferData = (await testResult).buffer;
const bufferData = testResult.buffer;
const myRefData = await (await fetch('./reference/440@48k-sine-octx.json')).json();

// compare bufferData samples to reference
Expand Down
16 changes: 8 additions & 8 deletions src/tests/playwright/pages/util/audit.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* @fileoverview Web Audio Test Suite management and utility functions.
* Specifies functions to define and evaluate Web Audio Tests and schedule
* execution making Web Audio tests compatible with Playwright and the
* Live Test Suite. Manages global test state for assertion handling.
*
* Specifies functions to define and evaluate Web Audio Tests and schedule
* execution making Web Audio tests compatible with Playwright and the
* Live Test Suite. Manages global test state for assertion handling.
*
* Additionally includes functions to validate audio processing.
*/

Expand Down Expand Up @@ -44,23 +44,23 @@ export const test = (testPromise) => {

/**
* Evaluates a Web Audio Test and assigns the result to window.webAudioEvaluate.
* If window._webAudioTestSuite property is true, the function is assigned
* If window._webAudioTestSuite property is true, the function is assigned
* directly. Otherwise, the function is invoked immediately.
*
* @param {Function} testFunction - The test function to evaluate.
* @return {any}
*/
export const evaluateTest =
(testFunction) => window.webAudioEvaluate = window._isTestSuiteMode
? () => testFunction(window._webAudioTest)
: testFunction(window._webAudioTest);
? async () => testFunction(await window._webAudioTest)
: (async () => testFunction(await window._webAudioTest))();

// global state to accumulate assert() tests
const tests = [];

/**
* Asserts a condition and logs a message if the condition is not met.
* If no arguments are specified, the function returns a boolean indicating
* If no arguments are specified, the function returns a boolean indicating
* whether all previous assertions were true.
*
* @param {boolean} condition - The condition to be checked.
Expand Down

0 comments on commit ef0cb6b

Please sign in to comment.