Skip to content

Commit

Permalink
Merge pull request #255 from achingbrain/fix/import-dom-execption-pro…
Browse files Browse the repository at this point in the history
…perly

fix: import and throw DOMException correctly
  • Loading branch information
murat-dogan authored Jun 9, 2024
2 parents d59c64c + 7b5401f commit a862c23
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 2 additions & 6 deletions polyfill/RTCPeerConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import RTCDataChannel from './RTCDataChannel.js';
import RTCIceCandidate from './RTCIceCandidate.js';
import { RTCDataChannelEvent, RTCPeerConnectionIceEvent } from './Events.js';
import RTCSctpTransport from './RTCSctpTransport.js';
import DOMException from 'node-domexception';
import 'node-domexception';

export default class _RTCPeerConnection extends EventTarget {
static async generateCertificate() {
throw new Error('Not implemented');
throw new DOMException('Not implemented');
}

#peerConnection;
Expand Down Expand Up @@ -192,10 +192,6 @@ export default class _RTCPeerConnection extends EventTarget {
return this.#peerConnection.signalingState();
}

static generateCertificate(keygenAlgorithm) {
throw new DOMException('Not implemented');
}

async addIceCandidate(candidate) {
if (candidate == null || candidate.candidate == null) {
throw new DOMException('Candidate invalid');
Expand Down
10 changes: 10 additions & 0 deletions test/jest-tests/polyfill.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { expect } from '@jest/globals';
import polyfill from '../../polyfill/index.js';

describe('polyfill', () => {
test('generateCertificate should throw', () => {
expect(async () => {
await polyfill.RTCPeerConnection.generateCertificate({});
}).rejects.toEqual(new DOMException('Not implemented'));
});
});

0 comments on commit a862c23

Please sign in to comment.