Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: import and throw DOMException correctly #255

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am OK with that

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'));
});
});
Loading