Skip to content

Commit

Permalink
chore(jest): add more jest tests (#3574)
Browse files Browse the repository at this point in the history
  • Loading branch information
stavares843 authored and JustZacca committed Jun 13, 2022
1 parent 196afa6 commit eac5cab
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
30 changes: 30 additions & 0 deletions libraries/WebRTC/Emitter.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as Emitter from '~/libraries/WebRTC/Emitter'

describe('Emitter.default.on', () => {
let inst: any

beforeEach(() => {
inst = new Emitter.default()
})

test('0', () => {
const result: any = inst.on(
'data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20baseProfile%3D%22full%22%20width%3D%22undefined%22%20height%3D%22undefined%22%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22grey%22%2F%3E%3Ctext%20x%3D%22NaN%22%20y%3D%22NaN%22%20font-size%3D%2220%22%20alignment-baseline%3D%22middle%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%3Eundefinedxundefined%3C%2Ftext%3E%3C%2Fsvg%3E',
false,
)
expect(result).toMatchSnapshot()
})

test('1', () => {
const result: any = inst.on(
'data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20baseProfile%3D%22full%22%20width%3D%22undefined%22%20height%3D%22undefined%22%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22grey%22%2F%3E%3Ctext%20x%3D%22NaN%22%20y%3D%22NaN%22%20font-size%3D%2220%22%20alignment-baseline%3D%22middle%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%3Eundefinedxundefined%3C%2Ftext%3E%3C%2Fsvg%3E',
true,
)
expect(result).toMatchSnapshot()
})

test('2', () => {
const result: any = inst.on('', true)
expect(result).toMatchSnapshot()
})
})
8 changes: 8 additions & 0 deletions libraries/WebRTC/Libp2p.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as Libp2p from '~/libraries/WebRTC/Libp2p'

describe('Libp2p.Peer2Peer.getInstance', () => {
test('0', () => {
const result: any = Libp2p.Peer2Peer.getInstance()
expect(result).toMatchSnapshot()
})
})
7 changes: 7 additions & 0 deletions libraries/WebRTC/__snapshots__/Emitter.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Emitter.default.on 0 1`] = `undefined`;

exports[`Emitter.default.on 1 1`] = `undefined`;

exports[`Emitter.default.on 2 1`] = `undefined`;
7 changes: 7 additions & 0 deletions libraries/WebRTC/__snapshots__/Libp2p.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Libp2p.Peer2Peer.getInstance 0 1`] = `
Peer2Peer {
"_events": Object {},
}
`;

0 comments on commit eac5cab

Please sign in to comment.