Skip to content

Commit 6781e29

Browse files
authored
Merge pull request #42 from qwerzl/chore/parseaple-typedstream
chore: switch to @parseaple/typedstream
2 parents 988a0e6 + d4643a5 commit 6781e29

File tree

5 files changed

+585
-470
lines changed

5 files changed

+585
-470
lines changed

__tests__/12-attributed-body.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
22
* AttributedBody Extraction Tests
33
*
4-
* Tests for the node-typedstream based attributedBody extraction
4+
* Tests for the @parseaple/typedstream based attributedBody extraction
55
*/
66

77
import { describe, expect, it } from 'bun:test'
8-
import { NSAttributedString, Unarchiver } from 'node-typedstream'
8+
import { NSAttributedString, Unarchiver } from '@parseaple/typedstream'
99

1010
/**
1111
* Helper function that mirrors the extraction logic in database.ts
@@ -36,7 +36,7 @@ function extractTextFromAttributedBody(attributedBody: unknown): string | null {
3636
return item.string
3737
}
3838

39-
if (item?.values && Array.isArray(item.values)) {
39+
if (item !== null && typeof item === 'object' && 'values' in item && Array.isArray(item.values)) {
4040
for (const val of item.values) {
4141
if (val instanceof NSAttributedString && val.string) {
4242
return val.string
@@ -88,12 +88,12 @@ describe('AttributedBody Extraction', () => {
8888

8989
describe('NSAttributedString Handling', () => {
9090
it('should correctly identify NSAttributedString type', () => {
91-
const instance = new NSAttributedString()
91+
const instance = new NSAttributedString('', [])
9292
expect(instance).toBeInstanceOf(NSAttributedString)
9393
})
9494

9595
it('should access string property of NSAttributedString', () => {
96-
const instance = new NSAttributedString()
96+
const instance = new NSAttributedString('', [])
9797
// NSAttributedString.string is the property we need
9898
expect('string' in instance).toBe(true)
9999
})

0 commit comments

Comments
 (0)