-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: check for custom sw install path
- Loading branch information
Showing
3 changed files
with
34 additions
and
6 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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import assert from 'node:assert/strict' | ||
import { describe, it } from 'node:test' | ||
import { widgetConfigFromUrl } from '#src/widget/widget-config.js' | ||
|
||
describe('widget-config', () => { | ||
it('should get default config from URL', () => { | ||
const clientKey = 'abc123' | ||
const url = `https://portal.saturn.tech/widget.js#integration=${clientKey}` | ||
|
||
const config = widgetConfigFromUrl(url) | ||
assert.strictEqual(config.clientKey, clientKey) | ||
assert.strictEqual(config.installPath, '/') | ||
}) | ||
|
||
it('should get config from URL', () => { | ||
const clientKey = 'abc123' | ||
const installPath = '/test' | ||
const url = `https://portal.saturn.tech/widget.js#integration=${clientKey}&installPath=${installPath}` | ||
|
||
const config = widgetConfigFromUrl(url) | ||
assert.strictEqual(config.clientKey, clientKey) | ||
assert.strictEqual(config.installPath, installPath) | ||
}) | ||
}) |