UNPKG

@hero-design/snowflake-guard

Version:

A hero-design bot detecting snowflake usage

44 lines (43 loc) 1.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const getDiffLocs_1 = require("../getDiffLocs"); describe('getDiffLocs', () => { it('returns diff locations from patches', () => { const filePatch = "@@ -4,8 +4,6 @@ import { Button, Typography, Box, ButtonProps } from '@hero-design/react';\n" + ' \n' + " import emptyBanner from './assets/empty-banner.png';\n" + ' \n' + "-console.log('test');\n" + '-\n' + ' const EmptyImg = styled.img`\n' + ' height: 172px;\n' + ` margin-bottom: \${({ theme }) => theme.space.small}px;\n` + '@@ -28,7 +26,8 @@ const EmptyTableView = ({\n' + ' <EmptyImg src={emptyBanner} alt="Empty" />\n' + ' <Typography.Text\n' + ' fontSize={14}\n' + "- sx={{ color: 'bodyText', mb: 'xxlarge', whiteSpace: 'pre-wrap' }} // @snowflake-guard/snowflake-approved-by-andromeda\n" + "+ sx={{ color: 'bodyText', mb: 'xxlarge', whiteSpace: 'pre-wrap', backgroundColour: 'lightPrimary' }} // @snowflake-guard/snowflake-approved-by-andromeda\n" + '+ aria-label="Empty table message"\n' + ' >\n' + ' {message}\n' + ' </Typography.Text>\n' + '@@ -39,6 +38,7 @@ const EmptyTableView = ({\n' + ' text={buttonText}\n' + ' />\n' + ' </Box>\n' + '+\n' + ' );\n' + ' \n' + ' export default EmptyTableView;'; expect((0, getDiffLocs_1.getDiffLocs)(filePatch)).toEqual([ [7, 6], [29, 30], [41, 41], ]); }); it('returns empty for empty patches', () => { const filePatch = ''; expect((0, getDiffLocs_1.getDiffLocs)(filePatch)).toEqual([]); }); });