/**
* Copyright Super iPaaS Integration LLC, an IBM Company 2024
*/
import {ZipManager} from '../../src/managers/zip.manager.js';
import path from 'path';
import fs from 'fs';
jest.mock('../../src/service/log-wrapper.ts');

describe('zipmanager', () => {
	test('should return API endpoints when the key exists', () => {
		const zipFilePath = path.resolve(__dirname, '../assets/valid-asset.zip');
		const zipBuffer = fs.readFileSync(zipFilePath);
		const handler = new ZipManager(zipBuffer);
		expect(handler.getEntryByName('asset')).not.toBeUndefined();
	});

	test('should return an empty array when the key does not exist', async() => {
		const zipFilePath = path.resolve(__dirname, '../assets/valid-asset.zip');
		const zipBuffer = fs.readFileSync(zipFilePath);
		const handler = new ZipManager(zipBuffer);
		expect(await handler.getEntryByName('no-asset')).toBeUndefined();
	});


});
