-
Notifications
You must be signed in to change notification settings - Fork 20
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
Showing
9 changed files
with
51 additions
and
17 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
4 changes: 2 additions & 2 deletions
4
packages/timeline-state-resolver-types/src/integrations/httpSend.ts
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,12 @@ | ||
import { DeviceType, HTTPSendCommandContent, StringInterpolation } from '..' | ||
import { DeviceType, HTTPSendCommandContent, TemplateString } from '..' | ||
|
||
export type TimelineContentHTTPSendAny = TimelineContentHTTPRequest | ||
export interface TimelineContentHTTPSendBase { | ||
deviceType: DeviceType.HTTPSEND | ||
} | ||
|
||
export interface HTTPSendCommandContentExt extends Omit<HTTPSendCommandContent, 'url'> { | ||
url: string | StringInterpolation | ||
url: string | TemplateString | ||
} | ||
|
||
export type TimelineContentHTTPRequest = TimelineContentHTTPSendBase & HTTPSendCommandContentExt |
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
34 changes: 34 additions & 0 deletions
34
packages/timeline-state-resolver/src/__tests__/lib.spec.ts
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,34 @@ | ||
import { interpolateTemplateString, interpolateTemplateStringIfNeeded } from '../lib' | ||
|
||
describe('interpolateTemplateString', () => { | ||
test('basic input', () => { | ||
expect(interpolateTemplateString('Hello there {{name}}', { name: 'Bob' })).toEqual('Hello there Bob') | ||
}) | ||
|
||
test('missing arg', () => { | ||
expect(interpolateTemplateString('Hello there {{name}}', {})).toEqual('Hello there name') | ||
}) | ||
|
||
test('repeated arg', () => { | ||
expect(interpolateTemplateString('Hello there {{name}} {{name}} {{name}}', { name: 'Bob' })).toEqual( | ||
'Hello there Bob Bob Bob' | ||
) | ||
}) | ||
}) | ||
|
||
describe('interpolateTemplateStringIfNeeded', () => { | ||
test('string input', () => { | ||
const input = 'Hello there' | ||
|
||
expect(interpolateTemplateStringIfNeeded(input)).toEqual(input) | ||
}) | ||
|
||
test('object input', () => { | ||
expect( | ||
interpolateTemplateStringIfNeeded({ | ||
key: 'Hello there {{name}}', | ||
args: { name: 'Bob' }, | ||
}) | ||
).toEqual('Hello there Bob') | ||
}) | ||
}) |
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
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