This repository has been archived by the owner on Apr 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af62ff8
commit fa645a6
Showing
2 changed files
with
158 additions
and
202 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 |
---|---|---|
@@ -1,12 +1,25 @@ | ||
import './advanzia-assistant'; | ||
import { Script } from './advanzia-assistant'; | ||
|
||
describe('Content Script', () => { | ||
it('should not do anything if not on transactions page', async () => { | ||
await new Promise((resolve) => { | ||
new Script() | ||
.on('noop', () => resolve(void 0)) | ||
.execute(); | ||
}); | ||
const eventsRaised: { [key: string]: boolean } = { | ||
noop: false, | ||
ready: false, | ||
done: false, | ||
error: false, | ||
}; | ||
|
||
const setRaised = (eventName: string) => () => { eventsRaised[eventName] = true }; | ||
|
||
await new Script() | ||
.on('noop', setRaised('noop')) | ||
.on('ready', () => setRaised('ready')) | ||
.on('done', () => setRaised('done')) | ||
.execute(); | ||
|
||
expect(eventsRaised.noop).toBe(true); | ||
expect(eventsRaised.ready).toBe(false); | ||
expect(eventsRaised.done).toBe(false); | ||
expect(eventsRaised.error).toBe(false); | ||
}); | ||
}); |
Oops, something went wrong.