Skip to content

Commit

Permalink
add import method test
Browse files Browse the repository at this point in the history
  • Loading branch information
mazyu36 committed Oct 26, 2024
1 parent 38ce28e commit a201f7f
Showing 1 changed file with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { App, Duration, Stack } from 'aws-cdk-lib';
import { Template } from 'aws-cdk-lib/assertions';
import { Bucket } from 'aws-cdk-lib/aws-s3';
import { RecordingConfiguration, RenditionSelection, Resolution, ThumbnailRecordingMode, ThumbnailStorage } from '../lib';
import { IRecordingConfiguration, RecordingConfiguration, RenditionSelection, Resolution, ThumbnailRecordingMode, ThumbnailStorage } from '../lib';

describe('IVS Recording Configuration', () => {
let app: App;
Expand Down Expand Up @@ -240,6 +240,54 @@ describe('IVS Recording Configuration', () => {
});
});

describe('fromRecordingConfigurationId method test', () => {
let importRecordingConfiguration: IRecordingConfiguration;

beforeEach(() => {
app = new App();
stack = new Stack(app, 'TestStack');
importRecordingConfiguration = RecordingConfiguration.fromRecordingConfigurationId(stack, 'ImportedRecordingConfiguration', 'my-record-configuration');
});

test('should correctly set recordingConfigurationId', () => {
expect(importRecordingConfiguration.recordingConfigurationId).toEqual('my-record-configuration');
});

test('should correctly format recordingConfigurationArn', () => {
expect(importRecordingConfiguration.recordingConfigurationArn).toEqual(
Stack.of(stack).formatArn({
service: 'ivs',
resource: 'recording-configuration',
resourceName: 'my-record-configuration',
}),
);
});
});

describe('fromArn method test', () => {
let importRecordingConfiguration: IRecordingConfiguration;

beforeEach(() => {
app = new App();
stack = new Stack(app, 'TestStack');
importRecordingConfiguration = RecordingConfiguration.fromArn(stack, 'ImportedRecordingConfiguration', 'arn:aws:ivs:us-east-1:012345678912:recording-configuration/my-record-configuration');
});

test('should correctly set recordingConfigurationId', () => {
expect(importRecordingConfiguration.recordingConfigurationId).toEqual('my-record-configuration');
});

test('should correctly format recordingConfigurationArn', () => {
expect(importRecordingConfiguration.recordingConfigurationArn).toEqual(
Stack.of(stack).formatArn({
service: 'ivs',
resource: 'recording-configuration',
resourceName: 'my-record-configuration',
}),
);
});
});

describe('validateRecordingConfigurationName test', () => {
test('throws when recordingConfigurationName include invalid characters.', () => {
expect(() => {
Expand Down

0 comments on commit a201f7f

Please sign in to comment.