Skip to content

Commit

Permalink
Add tests for doc state docLastExportedTimestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
glenreesor committed Apr 8, 2023
1 parent 757f626 commit 869302f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/state/documentState.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Glen Reesor
// Copyright 2022, 2023 Glen Reesor
//
// This file is part of m3 Mind Mapper.
//
Expand Down Expand Up @@ -438,6 +438,12 @@ describe('getCurrentDocAsJson / replaceCurrentDocFromJson', () => {
});
});

describe('getDocLastExportedTimestamp', () => {
it('returns undefined for a newly created document', () => {
expect(docState.getDocLastExportedTimestamp()).toBe(undefined);
});
});

describe('getDocName / setDocName', () => {
it('returns the name that was set for this document', () => {
const docName = 'the doc name';
Expand Down Expand Up @@ -814,3 +820,13 @@ describe('replaceNodeContents', () => {
expect(docState.getNodeContents(rootNodeId)).toBe(newContents);
});
});

describe('setDocLastExportedTimestamp', () => {
it('updates the value and sets hasUnsavedChanges to true', () => {
const testTimestamp = Date.now();
docState.setDocLastExportedTimestamp(testTimestamp);

expect(docState.getDocLastExportedTimestamp()).toBe(testTimestamp);
expect(docState.hasUnsavedChanges()).toBe(true);
});
});

0 comments on commit 869302f

Please sign in to comment.