|
1 | 1 | import { assertEquals, assertInstanceOf } from '@std/assert'; |
2 | | -import { PLBoolean, PLDictionary } from '@hqtsm/plist'; |
| 2 | +import { PLBoolean, PLData, PLDictionary } from '@hqtsm/plist'; |
3 | 3 | import { assertThrowsMacOSError } from '../../spec/assert.ts'; |
4 | 4 | import { |
5 | 5 | CPU_ARCHITECTURES, |
@@ -171,6 +171,38 @@ Deno.test('EmbeddedSignatureBlob: blobData', () => { |
171 | 171 | }, errSecCSSignatureInvalid); |
172 | 172 | }); |
173 | 173 |
|
| 174 | +Deno.test('EmbeddedSignatureBlob: component', () => { |
| 175 | + { |
| 176 | + const maker = new EmbeddedSignatureBlob_Maker(); |
| 177 | + const made = EmbeddedSignatureBlob_Maker.make(maker); |
| 178 | + const component = EmbeddedSignatureBlob.component( |
| 179 | + made, |
| 180 | + cdSignatureSlot, |
| 181 | + ); |
| 182 | + assertEquals(component, null); |
| 183 | + } |
| 184 | + { |
| 185 | + const maker = new EmbeddedSignatureBlob_Maker(); |
| 186 | + const filler = new ArrayBuffer(16); |
| 187 | + for (let a = new Uint8Array(filler), i = filler.byteLength; i--;) { |
| 188 | + a[i] = i; |
| 189 | + } |
| 190 | + const blob = new BlobCore(filler); |
| 191 | + BlobCore.initialize(blob, cdRequirementsSlot, filler.byteLength); |
| 192 | + EmbeddedSignatureBlob_Maker.add(maker, cdRequirementsSlot, blob); |
| 193 | + const made = EmbeddedSignatureBlob_Maker.make(maker); |
| 194 | + const component = EmbeddedSignatureBlob.component( |
| 195 | + made, |
| 196 | + cdRequirementsSlot, |
| 197 | + ); |
| 198 | + assertInstanceOf(component, PLData); |
| 199 | + assertEquals( |
| 200 | + new Uint8Array(component.buffer), |
| 201 | + new Uint8Array(filler), |
| 202 | + ); |
| 203 | + } |
| 204 | +}); |
| 205 | + |
174 | 206 | Deno.test('EmbeddedSignatureBlob: fixtures', async () => { |
175 | 207 | const signedFictures = fixtures.filter((f) => |
176 | 208 | [...f.archs.values()].filter(Boolean).length |
|
0 commit comments