test: verify serialization of "undefined" fields (#1721)

Fixes #1510.
This commit is contained in:
Andrey Lushnikov 2018-01-04 11:30:29 -08:00 committed by GitHub
parent 3481f03b80
commit f0b11ad22e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -389,6 +389,9 @@ describe('Page', function() {
const result = await page.evaluate((a, b) => Object.is(a, undefined) && Object.is(b, 'foo'), undefined, 'foo');
expect(result).toBe(true);
});
it('should properly serialize null fields', async({page}) => {
expect(await page.evaluate(() => ({a: undefined}))).toEqual({});
});
it('should fail for window object', async({page, server}) => {
const result = await page.evaluate(() => window);
expect(result).toBe(undefined);