Converted some left-over JavaScript file to TypeScript

Summary: Found some errors in a CI failure originating from a JavaScript file. The horror!

Reviewed By: jknoxville

Differential Revision: D29549998

fbshipit-source-id: 633100ec9a446050bb0c703dcc37e9b132b17198
This commit is contained in:
Michel Weststrate
2021-07-06 01:45:41 -07:00
committed by Facebook GitHub Bot
parent 9ca8bee208
commit 04ec026034
11 changed files with 41 additions and 33 deletions

View File

@@ -0,0 +1,35 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {buildLocalIconPath, buildIconURL} from '../icons';
import * as path from 'path';
test('filled icons get correct local path', () => {
const iconPath = buildLocalIconPath('star', 12, 2);
expect(iconPath).toBe(path.join('icons', 'star-filled-12@2x.png'));
});
test('outline icons get correct local path', () => {
const iconPath = buildLocalIconPath('star-outline', 12, 2);
expect(iconPath).toBe(path.join('icons', 'star-outline-12@2x.png'));
});
test('filled icons get correct URL', () => {
const iconUrl = buildIconURL('star', 12, 2);
expect(iconUrl).toBe(
'https://facebook.com/assets/?name=star&variant=filled&size=12&set=facebook_icons&density=2x',
);
});
test('outline icons get correct URL', () => {
const iconUrl = buildIconURL('star-outline', 12, 2);
expect(iconUrl).toBe(
'https://facebook.com/assets/?name=star&variant=outline&size=12&set=facebook_icons&density=2x',
);
});