-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into test-published-packages
- Loading branch information
Showing
48 changed files
with
673 additions
and
491 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
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 |
---|---|---|
@@ -1,26 +1,36 @@ | ||
import { createSQLEditorInstance, EditorCache } from '..' | ||
|
||
test('editor instance cache works fine', () => { | ||
describe('editor instance cache works fine', () => { | ||
const cache = new EditorCache() | ||
const editorInst = createSQLEditorInstance({ | ||
editorId: '111', | ||
doc: 'select * from test;' | ||
}) | ||
|
||
expect(cache.getEditor('111')).toBe(undefined) | ||
test('no cache added', () => { | ||
expect(cache.getEditor('111')).toBe(undefined) | ||
}) | ||
|
||
cache.addEditor('111', editorInst) | ||
expect(cache.getEditor('111')).toBe(editorInst) | ||
test('add one instance 111 to cache', () => { | ||
cache.addEditor('111', editorInst) | ||
expect(cache.getEditor('111')).toBe(editorInst) | ||
}) | ||
|
||
cache.deleteEditor('222') | ||
expect(cache.getEditor('111')).toBe(editorInst) | ||
test('remove instance 222 from cache', () => { | ||
cache.deleteEditor('222') | ||
expect(cache.getEditor('111')).toBe(editorInst) | ||
}) | ||
|
||
cache.deleteEditor('111') | ||
expect(cache.getEditor('111')).toBe(undefined) | ||
test('remove instance 111 from cache', () => { | ||
cache.deleteEditor('111') | ||
expect(cache.getEditor('111')).toBe(undefined) | ||
}) | ||
|
||
cache.addEditor('111', editorInst) | ||
expect(cache.getEditor('111')).toBe(editorInst) | ||
test('clear cache', () => { | ||
cache.addEditor('111', editorInst) | ||
expect(cache.getEditor('111')).toBe(editorInst) | ||
|
||
cache.clearEditors() | ||
expect(cache.getEditor('111')).toBe(undefined) | ||
cache.clearEditors() | ||
expect(cache.getEditor('111')).toBe(undefined) | ||
}) | ||
}) |
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
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
Oops, something went wrong.