mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
bafdf8d9f2
Update all tests for `no-var` and `prefer-arrow-callback` (using `--fix`)
57 lines
1.4 KiB
JavaScript
57 lines
1.4 KiB
JavaScript
const test = require('tap').test;
|
||
const StringUtil = require('../../src/util/string-util');
|
||
|
||
test('withoutTrailingDigits', t => {
|
||
t.strictEqual(StringUtil.withoutTrailingDigits('boeing747'), 'boeing');
|
||
t.strictEqual(StringUtil.withoutTrailingDigits('boeing747 '), 'boeing747 ');
|
||
t.strictEqual(StringUtil.withoutTrailingDigits('boeing𝟨'), 'boeing𝟨');
|
||
t.strictEqual(StringUtil.withoutTrailingDigits('boeing 747'), 'boeing ');
|
||
t.strictEqual(StringUtil.withoutTrailingDigits('747'), '');
|
||
t.end();
|
||
});
|
||
|
||
test('unusedName', t => {
|
||
t.strictEqual(
|
||
StringUtil.unusedName(
|
||
'name',
|
||
['not the same name']
|
||
),
|
||
'name'
|
||
);
|
||
t.strictEqual(
|
||
StringUtil.unusedName(
|
||
'name',
|
||
['name']
|
||
),
|
||
'name2'
|
||
);
|
||
t.strictEqual(
|
||
StringUtil.unusedName(
|
||
'name',
|
||
['name30']
|
||
),
|
||
'name'
|
||
);
|
||
t.strictEqual(
|
||
StringUtil.unusedName(
|
||
'name',
|
||
['name', 'name2']
|
||
),
|
||
'name3'
|
||
);
|
||
t.strictEqual(
|
||
StringUtil.unusedName(
|
||
'name',
|
||
['name', 'name3']
|
||
),
|
||
'name2'
|
||
);
|
||
t.strictEqual(
|
||
StringUtil.unusedName(
|
||
'boeing747',
|
||
['boeing747']
|
||
),
|
||
'boeing2' // Yup, this matches scratch-flash...
|
||
);
|
||
t.end();
|
||
});
|