Skip to content

Commit a862c23

Browse files
authored
Merge pull request #255 from achingbrain/fix/import-dom-execption-properly
fix: import and throw DOMException correctly
2 parents d59c64c + 7b5401f commit a862c23

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

polyfill/RTCPeerConnection.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import RTCDataChannel from './RTCDataChannel.js';
44
import RTCIceCandidate from './RTCIceCandidate.js';
55
import { RTCDataChannelEvent, RTCPeerConnectionIceEvent } from './Events.js';
66
import RTCSctpTransport from './RTCSctpTransport.js';
7-
import DOMException from 'node-domexception';
7+
import 'node-domexception';
88

99
export default class _RTCPeerConnection extends EventTarget {
1010
static async generateCertificate() {
11-
throw new Error('Not implemented');
11+
throw new DOMException('Not implemented');
1212
}
1313

1414
#peerConnection;
@@ -192,10 +192,6 @@ export default class _RTCPeerConnection extends EventTarget {
192192
return this.#peerConnection.signalingState();
193193
}
194194

195-
static generateCertificate(keygenAlgorithm) {
196-
throw new DOMException('Not implemented');
197-
}
198-
199195
async addIceCandidate(candidate) {
200196
if (candidate == null || candidate.candidate == null) {
201197
throw new DOMException('Candidate invalid');

test/jest-tests/polyfill.test.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { expect } from '@jest/globals';
2+
import polyfill from '../../polyfill/index.js';
3+
4+
describe('polyfill', () => {
5+
test('generateCertificate should throw', () => {
6+
expect(async () => {
7+
await polyfill.RTCPeerConnection.generateCertificate({});
8+
}).rejects.toEqual(new DOMException('Not implemented'));
9+
});
10+
});

0 commit comments

Comments
 (0)