mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
632ae0b7c3
* Prevent new JS files in shared folder * migrate to typescript * fix types * cleanup
30 lines
935 B
TypeScript
30 lines
935 B
TypeScript
import { generateModifyFilesDiff } from '../common/test-data';
|
|
import { preventSinonAssertSyntax } from './sinon-assert-syntax';
|
|
|
|
describe('preventSinonAssertSyntax()', (): void => {
|
|
it('should pass when receiving an empty diff', (): void => {
|
|
const testDiff = '';
|
|
|
|
const hasRulePassed = preventSinonAssertSyntax(testDiff);
|
|
|
|
expect(hasRulePassed).toBe(true);
|
|
});
|
|
|
|
it('should not pass when receiving a diff with one of the blocked expressions', (): void => {
|
|
const infringingExpression = 'assert.equal';
|
|
const testDiff = [
|
|
generateModifyFilesDiff('new-file.ts', 'foo', 'bar'),
|
|
generateModifyFilesDiff('old-file.js', undefined, 'pong'),
|
|
generateModifyFilesDiff(
|
|
'test.js',
|
|
`yada yada ${infringingExpression} yada yada`,
|
|
undefined,
|
|
),
|
|
].join('');
|
|
|
|
const hasRulePassed = preventSinonAssertSyntax(testDiff);
|
|
|
|
expect(hasRulePassed).toBe(false);
|
|
});
|
|
});
|