mirror of
https://github.com/flutter/holobooth.git
synced 2025-08-06 06:44:56 +08:00
fix: share link extension (#428)
This commit is contained in:
@ -38,7 +38,7 @@ describe('Share API', () => {
|
||||
|
||||
test('Invalid file extension returns 404 and html', async () => {
|
||||
const req = Object.assign({}, baseReq, {
|
||||
path: 'wrong.mp3',
|
||||
path: 'wrong.gif',
|
||||
});
|
||||
const res = await getShareResponse(req);
|
||||
expect(res.status).toEqual(404);
|
||||
|
@ -14,7 +14,7 @@ import portalAnimationControllerTmpl from './templates/portal-animation-controll
|
||||
import gaTmpl from './templates/ga';
|
||||
|
||||
|
||||
const VALID_VIDEO_EXT = [ '.mp4', '.gif' ];
|
||||
const VALID_VIDEO_EXT = [ '.mp4' ];
|
||||
|
||||
const BaseHTMLContext: Record<string, string | Record<string, string>> = {
|
||||
appUrl: '',
|
||||
|
@ -93,7 +93,7 @@ class ConvertRepository {
|
||||
json,
|
||||
_processedFrames.first,
|
||||
);
|
||||
final shareUrl = _getShareUrl(videoResponse.gifUrl);
|
||||
final shareUrl = _getShareUrl(videoResponse.videoUrl);
|
||||
final shareText = Uri.encodeComponent(
|
||||
'A new reality awaits in the #FlutterHolobooth. '
|
||||
'See you at #FlutterForward!',
|
||||
|
@ -93,19 +93,25 @@ void main() {
|
||||
expect(repository.generateVideo(), throwsException);
|
||||
});
|
||||
|
||||
test('return ConvertResponse with video, gif and first frame', () async {
|
||||
when(() => streamedResponse.statusCode).thenReturn(200);
|
||||
when(() => streamedResponse.stream).thenAnswer(
|
||||
(_) => ByteStream.fromBytes(
|
||||
'{"video_url": "video", "gif_url": "gif"}'.codeUnits,
|
||||
),
|
||||
);
|
||||
final response = await convertRepository.generateVideo();
|
||||
test(
|
||||
'return ConvertResponse with video, gif and first frame, and share '
|
||||
'urls',
|
||||
() async {
|
||||
when(() => streamedResponse.statusCode).thenReturn(200);
|
||||
when(() => streamedResponse.stream).thenAnswer(
|
||||
(_) => ByteStream.fromBytes(
|
||||
'{"video_url": "video", "gif_url": "gif"}'.codeUnits,
|
||||
),
|
||||
);
|
||||
final response = await convertRepository.generateVideo();
|
||||
|
||||
expect(response.videoUrl, equals('video'));
|
||||
expect(response.gifUrl, equals('gif'));
|
||||
expect(response.firstFrame, Uint8List(1));
|
||||
});
|
||||
expect(response.videoUrl, equals('video'));
|
||||
expect(response.gifUrl, equals('gif'));
|
||||
expect(response.firstFrame, Uint8List(1));
|
||||
expect(response.twitterShareUrl, contains(response.videoUrl));
|
||||
expect(response.facebookShareUrl, contains(response.videoUrl));
|
||||
},
|
||||
);
|
||||
|
||||
test('throws ConvertException on status code different than 200',
|
||||
() async {
|
||||
|
Reference in New Issue
Block a user