Repository: electron/electron
Pull request: test: add TS smoke test for electron/utility

#### Description of Change

<!--
Thank you for your Pull Request. Please provide a description above and review
the requirements below.

Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md
-->

We were missing any TS smoke test coverage for `electron/utility` so add some.

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd

#### Release Notes

Notes: none <!-- Please add a one-line description for app developers to read in the release notes, or 'none' if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/main/README.md#examples -->


Changed files:
filename: spec/ts-smoke/electron/utility.ts
patch: @@ -0,0 +1,67 @@
+/* eslint-disable */
+
+import { net, systemPreferences } from 'electron/utility';
+
+process.parentPort.on('message', (e) => {
+  if (e.data === 'Hello from parent!') {
+    process.parentPort.postMessage('Hello from child!');
+  }
+});
+
+// net
+// https://github.com/electron/electron/blob/main/docs/api/net.md
+
+const request = net.request('https://github.com');
+request.setHeader('Some-Custom-Header-Name', 'Some-Custom-Header-Value');
+const header = request.getHeader('Some-Custom-Header-Name');
+console.log('header', header);
+request.removeHeader('Some-Custom-Header-Name');
+request.on('response', (response) => {
+  console.log(`Status code: ${response.statusCode}`);
+  console.log(`Status message: ${response.statusMessage}`);
+  console.log(`Headers: ${JSON.stringify(response.headers)}`);
+  console.log(`Http version: ${response.httpVersion}`);
+  console.log(`Major Http version: ${response.httpVersionMajor}`);
+  console.log(`Minor Http version: ${response.httpVersionMinor}`);
+  response.on('data', (chunk) => {
+    console.log(`BODY: ${chunk}`);
+  });
+  response.on('end', () => {
+    console.log('No more data in response.');
+  });
+  response.on('error', () => {
+    console.log('"error" event emitted');
+  });
+  response.on('aborted', () => {
+    console.log('"aborted" event emitted');
+  });
+});
+request.on('login', (authInfo, callback) => {
+  callback('username', 'password');
+});
+request.on('finish', () => {
+  console.log('"finish" event emitted');
+});
+request.on('abort', () => {
+  console.log('"abort" event emitted');
+});
+request.on('error', () => {
+  console.log('"error" event emitted');
+});
+request.write('Hello World!', 'utf-8');
+request.end('Hello World!', 'utf-8');
+request.abort();
+
+// systemPreferences
+// https://github.com/electron/electron/blob/main/docs/api/system-preferences.md
+
+if (process.platform === 'win32') {
+  systemPreferences.on('color-changed', () => { console.log('color changed'); });
+}
+
+if (process.platform === 'darwin') {
+  const value = systemPreferences.getUserDefault('Foo', 'string');
+  console.log(value);
+  const value2 = systemPreferences.getUserDefault('Foo', 'boolean');
+  console.log(value2);
+}

filename: spec/ts-smoke/tsconfig.json
patch: @@ -15,6 +15,7 @@
   "files": [
     "electron/main.ts",
     "electron/renderer.ts",
+    "electron/utility.ts",
     "../../electron.d.ts"
   ]
 }
\ No newline at end of file