Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
marcprux committed May 25, 2024
1 parent f838113 commit 7a00325
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 0.1.1

Released 2024-05-25

- Add Timestamp properties and functions
- Fix Timestamp Hashable
- Re-enable tests
- Add Timestamp
- Bump firebase-bom version to 33.0.0; add more docs to README
- ci: update workflow actions location
- Update docs to mention sample Fireside app

## 0.1.0

Released 2024-02-05
Expand Down
6 changes: 5 additions & 1 deletion Sources/SkipFirebaseFirestore/SkipFirebaseFirestore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,14 @@ public class Timestamp: Hashable, KotlinConverting<com.google.firebase.Timestamp
hasher.combine(timestamp.hashCode())
}

public func toDate() -> Date {
public func dateValue() -> Date {
Date(platformValue: timestamp.toDate())
}

public func toDate() -> Date {
dateValue()
}

public var seconds: Int64 {
timestamp.seconds
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ final class SkipFirebaseFirestoreTests: XCTestCase {
}
}

XCTAssertEqual(Timestamp(date: Date(timeIntervalSince1970: 12345)), Timestamp(seconds: 12345, nanoseconds: 0))
let ts = Timestamp(seconds: 12345, nanoseconds: 100_000_000)
XCTAssertEqual(12345, ts.seconds)
XCTAssertEqual(100_000_000, ts.nanoseconds)
XCTAssertEqual(12345.1, ts.dateValue().timeIntervalSince1970, accuracy: 0.001)

let bos = citiesRef.document("BOS")

Expand Down Expand Up @@ -259,11 +262,11 @@ final class SkipFirebaseFirestoreTests: XCTestCase {
}

// follow-on test since running multiple separate firestore tests in a single case seems to fail (possibly due to re-configuration of the FirebaseApp app)
try await XXXtestFirestoreQuery()
//try await XXXtestFirestoreBundles()
try await followon_testFirestoreQuery()
//try await followon_testFirestoreBundles()
}

func XXXtestFirestoreQuery() async throws {
func followon_testFirestoreQuery() async throws {
XCTAssertEqual(appName, self.app.name)

let db = Firestore.firestore(app: self.app)
Expand Down Expand Up @@ -301,7 +304,7 @@ final class SkipFirebaseFirestoreTests: XCTestCase {
//try await XXXtestFirestoreBundles()
}

func XXXtestFirestoreBundles() async throws {
func followon_testFirestoreBundles() async throws {

// see Resources/ firestore_bundle-1.json, firestore_bundle-2.json, firestore_bundle-3.json
let bundle1 = try Data(contentsOf: XCTUnwrap(Bundle.module.url(forResource: "firestore_bundle-1", withExtension: "json")))
Expand Down

0 comments on commit 7a00325

Please sign in to comment.