mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 21:33:06 +07:00
Refactor config.test.ts
This commit is contained in:
parent
c4560dd084
commit
19a01870e7
@ -1,52 +1,18 @@
|
|||||||
import * as config from '../src/config';
|
import * as config from '../src/config';
|
||||||
|
|
||||||
describe('Config tests', () => {
|
describe('Config tests', () => {
|
||||||
it('checking addINIValuesOnWindows', async () => {
|
it.each`
|
||||||
let win32: string = await config.addINIValues(
|
ini_values | os_version | output
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
${'a=b, c=d'} | ${'win32'} | ${'Add-Content "$php_dir\\php.ini" "a=b\nc=d"'}
|
||||||
'win32'
|
${'a=b, c=d'} | ${'linux'} | ${'echo "a=b\nc=d" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'}
|
||||||
);
|
${'a=b, c=d'} | ${'darwin'} | ${'echo "a=b\nc=d" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'}
|
||||||
expect(win32).toContain(
|
${'a=b, c=d'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||||
'Add-Content "$php_dir\\php.ini" "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata"'
|
`(
|
||||||
);
|
'checking addINIValues on $os_version',
|
||||||
|
async ({ini_values, os_version, output}) => {
|
||||||
win32 = await config.addINIValues(
|
expect(await config.addINIValues(ini_values, os_version)).toContain(
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
output
|
||||||
'openbsd'
|
);
|
||||||
);
|
}
|
||||||
expect(win32).toContain('Platform openbsd is not supported');
|
);
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addINIValuesOnLinux', async () => {
|
|
||||||
let linux: string = await config.addINIValues(
|
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
|
||||||
'linux',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
expect(linux).toContain(
|
|
||||||
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'
|
|
||||||
);
|
|
||||||
|
|
||||||
linux = await config.addINIValues(
|
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
|
||||||
'openbsd'
|
|
||||||
);
|
|
||||||
expect(linux).toContain('Platform openbsd is not supported');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addINIValuesOnDarwin', async () => {
|
|
||||||
let darwin: string = await config.addINIValues(
|
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
|
||||||
'darwin'
|
|
||||||
);
|
|
||||||
expect(darwin).toContain(
|
|
||||||
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'
|
|
||||||
);
|
|
||||||
|
|
||||||
darwin = await config.addINIValues(
|
|
||||||
'post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata',
|
|
||||||
'openbsd'
|
|
||||||
);
|
|
||||||
expect(darwin).toContain('Platform openbsd is not supported');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user