test: rename & split internal module tests (#37318)

This commit is contained in:
Milan Burda 2023-02-17 10:14:40 +01:00 committed by GitHub
parent 73b7aac6a4
commit 0a5e634736
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 21 deletions

View file

@ -0,0 +1,21 @@
import { expect } from 'chai';
import { parseCommaSeparatedKeyValue } from '../lib/browser/parse-features-string';
describe('feature-string parsing', () => {
it('is indifferent to whitespace around keys and values', () => {
const checkParse = (string: string, parsed: Record<string, string | boolean>) => {
const features = parseCommaSeparatedKeyValue(string);
expect(features).to.deep.equal(parsed);
};
checkParse('a=yes,c=d', { a: true, c: 'd' });
checkParse('a=yes ,c=d', { a: true, c: 'd' });
checkParse('a=yes, c=d', { a: true, c: 'd' });
checkParse('a=yes , c=d', { a: true, c: 'd' });
checkParse(' a=yes , c=d', { a: true, c: 'd' });
checkParse(' a= yes , c=d', { a: true, c: 'd' });
checkParse(' a = yes , c=d', { a: true, c: 'd' });
checkParse(' a = yes , c =d', { a: true, c: 'd' });
checkParse(' a = yes , c = d', { a: true, c: 'd' });
checkParse(' a = yes , c = d ', { a: true, c: 'd' });
});
});

View file

@ -2,26 +2,6 @@ import { expect } from 'chai';
import { BrowserWindow } from 'electron/main';
import { closeAllWindows } from './lib/window-helpers';
describe('feature-string parsing', () => {
it('is indifferent to whitespace around keys and values', () => {
const { parseCommaSeparatedKeyValue } = require('../lib/browser/parse-features-string');
const checkParse = (string: string, parsed: Record<string, string | boolean>) => {
const features = parseCommaSeparatedKeyValue(string);
expect(features).to.deep.equal(parsed);
};
checkParse('a=yes,c=d', { a: true, c: 'd' });
checkParse('a=yes ,c=d', { a: true, c: 'd' });
checkParse('a=yes, c=d', { a: true, c: 'd' });
checkParse('a=yes , c=d', { a: true, c: 'd' });
checkParse(' a=yes , c=d', { a: true, c: 'd' });
checkParse(' a= yes , c=d', { a: true, c: 'd' });
checkParse(' a = yes , c=d', { a: true, c: 'd' });
checkParse(' a = yes , c =d', { a: true, c: 'd' });
checkParse(' a = yes , c = d', { a: true, c: 'd' });
checkParse(' a = yes , c = d ', { a: true, c: 'd' });
});
});
describe('process._linkedBinding', () => {
describe('in the main process', () => {
it('can access electron_browser bindings', () => {

View file

@ -249,7 +249,6 @@ declare namespace ElectronInternal {
interface ModuleEntry {
name: string;
private?: boolean;
loader: ModuleLoader;
}