From a201f7f3d55abb30a7b0083e8b06c648b723d684 Mon Sep 17 00:00:00 2001 From: maz Date: Sat, 26 Oct 2024 11:52:13 +0900 Subject: [PATCH] add import method test --- .../test/recording-configuration.test.ts | 50 ++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-ivs-alpha/test/recording-configuration.test.ts b/packages/@aws-cdk/aws-ivs-alpha/test/recording-configuration.test.ts index c2f2820ba3297..8543a235388a5 100644 --- a/packages/@aws-cdk/aws-ivs-alpha/test/recording-configuration.test.ts +++ b/packages/@aws-cdk/aws-ivs-alpha/test/recording-configuration.test.ts @@ -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; @@ -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(() => {