diff --git a/__mocks__/minio.js b/__mocks__/minio.js new file mode 100644 index 0000000..026f8a1 --- /dev/null +++ b/__mocks__/minio.js @@ -0,0 +1,8 @@ +module.exports = { + Client: jest.fn().mockImplementation(() => ({ + bucketExists: jest.fn(), + makeBucket: jest.fn(), + putObject: jest.fn(), + getObject: jest.fn(), + })), +}; diff --git a/tests/basic.test.js b/tests/basic.test.js index b353074..c7f7590 100644 --- a/tests/basic.test.js +++ b/tests/basic.test.js @@ -1,4 +1,14 @@ +// MOCK FILE ESM BIAR JEST GA PARSE +jest.mock('../app/static/prefix.js', () => ({ + default: {}, +})); + +// MOCK MINIO BIAR GA CONNECT +jest.mock('minio', () => ({ + Client: jest.fn(() => ({})), +})); + test('load backend', () => { - require('../index'); // ⬅️ INI WAJIB + require('../index'); expect(true).toBe(true); });