This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #283 from SuperViz/chore/fix-hello-world-example
chore(config): add properties exemple to hello-world component and implement a sleep to wtr tests
- Loading branch information
Showing
7 changed files
with
36 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import sleep from './sleep'; | ||
|
||
describe('sleep', () => { | ||
test('should resolve after the specified time', async () => { | ||
const start = Date.now(); | ||
await sleep(1000); | ||
const end = Date.now(); | ||
expect(end - start).toBeGreaterThanOrEqual(1000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// eslint-disable-next-line | ||
const sleep = (ms: number = 100) => new Promise((resolve) => setTimeout(resolve, ms)); | ||
|
||
export default sleep; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { Participant } from '../../common/types/participant.types'; | ||
import { AblyRealtimeService } from '../../services/realtime'; | ||
import { AblyRealtime } from '../../services/realtime/ably/types'; | ||
|
||
export interface DefaultAttachComponentOptions { | ||
realtime: AblyRealtime; | ||
realtime: AblyRealtimeService; | ||
localParticipant: Participant; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
import '.'; | ||
import sleep from '../../common/utils/sleep'; | ||
|
||
const element = document.createElement('superviz-hello-world'); | ||
document.body.appendChild(element); | ||
|
||
describe('hello-world', () => { | ||
it('should have a div with text', async () => { | ||
test('should have a div with text', async () => { | ||
const renderedElement = document.getElementsByTagName('superviz-hello-world')[0]; | ||
|
||
renderedElement.setAttribute('name', 'John'); | ||
|
||
await sleep(); | ||
|
||
expect(renderedElement.shadowRoot?.querySelector('div')?.textContent).toEqual( | ||
'Hello from SuperViz!', | ||
'Hello from SuperViz, John', | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters