import {expect, test} from 'bun:test';
import {createIlst} from '../create/iso-base-media/create-ilst';
import {createCmt} from '../create/iso-base-media/ilst/create-cmt';
import {createToo} from '../create/iso-base-media/ilst/create-too';

const reference = new Uint8Array([
	0x00, 0x00, 0x00, 0x5e, 0x69, 0x6c, 0x73, 0x74, 0x00, 0x00, 0x00, 0x24, 0xa9,
	0x74, 0x6f, 0x6f, 0x00, 0x00, 0x00, 0x1c, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00,
	0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x61, 0x76, 0x66, 0x36, 0x31, 0x2e,
	0x37, 0x2e, 0x31, 0x30, 0x30, 0x00, 0x00, 0x00, 0x32, 0xa9, 0x63, 0x6d, 0x74,
	0x00, 0x00, 0x00, 0x2a, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x01, 0x00,
	0x00, 0x00, 0x00, 0x4d, 0x61, 0x64, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20,
	0x52, 0x65, 0x6d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x34, 0x2e, 0x30, 0x2e,
	0x32, 0x32, 0x37,
]);

test('ilst', () => {
	expect(
		createIlst([
			createToo('Lavf61.7.100'),
			createCmt('Made with Remotion 4.0.227'),
		]),
	).toEqual(reference);
});
