test: call "expect()" on a correct call stack (#23675)

This commit is contained in:
Alexey Kuzmin 2020-05-20 22:18:48 +02:00 committed by GitHub
parent 9d851b8791
commit 33d6a99d40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 49 deletions

View file

@ -866,19 +866,18 @@ describe('BrowserWindow module', () => {
});
describe('BrowserWindow.setContentSize(width, height)', () => {
it('sets the content size', (done) => {
it('sets the content size', async () => {
// NB. The CI server has a very small screen. Attempting to size the window
// larger than the screen will limit the window's size to the screen and
// cause the test to fail.
const size = [456, 567];
w.setContentSize(size[0], size[1]);
setImmediate(() => {
const after = w.getContentSize();
expect(after).to.deep.equal(size);
done();
});
await new Promise(setImmediate);
const after = w.getContentSize();
expect(after).to.deep.equal(size);
});
it('works for a frameless window', (done) => {
it('works for a frameless window', async () => {
w.destroy();
w = new BrowserWindow({
show: false,
@ -888,11 +887,9 @@ describe('BrowserWindow module', () => {
});
const size = [456, 567];
w.setContentSize(size[0], size[1]);
setImmediate(() => {
const after = w.getContentSize();
expect(after).to.deep.equal(size);
done();
});
await new Promise(setImmediate);
const after = w.getContentSize();
expect(after).to.deep.equal(size);
});
});