I've updated to appwrite 1.5 and and node-appwrite 12.0.1. Whenever I try to run a test which fakes the system time my request to create a new document keeps processing and does not complete at all. This is the code:
it('Should return work when an active work period is active', async () => {
// Arrange
const startDate = new Date(2024, 2, 2, 12).toISOString();
jest.useFakeTimers().setSystemTime(new Date(2024, 2, 2, 13));
await presencePeriodRepo.createDocument({
userId: testUserId,
startDate,
type: PresencePeriodType.Work,
expectedEndDate: new Date(2024, 2, 2, 17).toISOString(),
});
// Act
const result = await controller.getPresenceStatus(client);
// Assert
expect(result.status).toBe(PresenceStatus.Work);
})
Whenever I remove the usefakeTimers line the createDocument call completes just fine. This is the implementation of the createDocument function:
public async createDocument(data: Schema, permissions?: string[]): Promise<Schema & Models.Document> {
return this.databases.createDocument(this.databaseId, this.collectionId, ID.unique(), data, permissions);
}
Note this code was working fine in Appwrite 1.4.
Recommended threads
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...
- What Query's are valid for GetDocument?
Documentation shows that Queries are valid here, but doesn't explain which queries are valid. At first I presumed this to be a bug, but before creating a githu...