test: strengthen internal types (#7488)

This commit is contained in:
Joshua Chen 2022-05-25 15:38:44 +08:00 committed by GitHub
parent d50fe3b670
commit cd21a31005
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 67 additions and 55 deletions

View file

@ -10,8 +10,8 @@ import vfile from 'to-vfile';
import postcss from 'postcss';
import postCssRemoveOverriddenCustomProperties from '../index';
const processFixture = (name: string) => {
const input = vfile.readSync(
const processFixture = async (name: string) => {
const input = await vfile.read(
path.join(__dirname, '__fixtures__', `${name}.css`),
'utf8',
);
@ -23,11 +23,11 @@ const processFixture = (name: string) => {
};
describe('remove-overridden-custom-properties', () => {
it('overridden custom properties should be removed', () => {
expect(processFixture('normal')).toMatchSnapshot();
it('overridden custom properties should be removed', async () => {
await expect(processFixture('normal')).resolves.toMatchSnapshot();
});
it('overridden custom properties with `!important` rule should not be removed', () => {
expect(processFixture('important_rule')).toMatchSnapshot();
it('overridden custom properties with `!important` rule should not be removed', async () => {
await expect(processFixture('important_rule')).resolves.toMatchSnapshot();
});
});