This repository has been archived by the owner on Feb 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3f83ed
commit dc7864e
Showing
5 changed files
with
71 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { expect } from 'chai'; | ||
import { GrayTabGroup, INDEX_V1_KEY, loadAllTabGroups } from '../src/app/tabs'; | ||
import { dictOf } from '../src/lib/utils'; | ||
import { mockedBrowser, stubGlobals, unstubGlobals } from './utils'; | ||
|
||
describe('tabs', function() { | ||
beforeEach(async function() { | ||
await stubGlobals(); | ||
}); | ||
|
||
afterEach(function() { | ||
unstubGlobals(); | ||
}); | ||
|
||
it('should load old string format', async function() { | ||
const oldGroups: GrayTabGroup[] = [ | ||
{ | ||
tabs: [ | ||
{ | ||
url: '1', | ||
title: 'one', | ||
key: 0, | ||
}, | ||
{ | ||
url: '2', | ||
title: 'two', | ||
key: 1, | ||
}, | ||
], | ||
date: 1589760256, // May 17 2020 in Linux Timestamp. | ||
}, | ||
{ | ||
tabs: [ | ||
{ | ||
url: '3', | ||
title: 'three', | ||
key: 0, | ||
}, | ||
], | ||
date: 1589760257, | ||
}, | ||
]; | ||
mockedBrowser() | ||
.storage.local.get.withArgs(INDEX_V1_KEY) | ||
.returns(Promise.resolve(dictOf(INDEX_V1_KEY, JSON.stringify(oldGroups)))); | ||
const groups = await loadAllTabGroups(); | ||
for (const oldGroup of oldGroups) { | ||
oldGroup.date *= 1000; // Seconds to millis conversion. | ||
} | ||
expect(groups).to.deep.equal(oldGroups); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters