Files
coze-studio/frontend/infra/plugins/import-watch-loader/__test__/index.test.js
fanlv 890153324f feat: manually mirror opencoze's code from bytedance
Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
2025-07-20 17:36:12 +08:00

42 lines
931 B
JavaScript

import { describe, expect, it } from 'vitest';
import loader from '../index';
describe('test import-watch-loader', () => {
it('code include tailwind utils', () => {
const rawCode = `
@tailwind utilities;
body {
width: 100%;
}
`;
expect(() =>
loader.call(
{
resourcePath: 'test1 resourcePath',
callback: () => 0,
},
rawCode,
),
).toThrowError(
'Error: test1 resourcePath:引入了多余的 @tailwind utilities,请删除。如有疑问请找wangfocheng',
);
});
it('code not include tailwind utils', () => {
const rawCode = `
body {
width: 100%;
}
`;
const expectCode = rawCode;
loader.call(
{
resourcePath: 'test2 resourcePath',
callback: (error, code) => {
expect(code).toBe(expectCode);
},
},
rawCode,
);
});
});