-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rework(DB): naming like in prisma.io
The reasoning behind this is to make it easier to find code that does updates, or just fetches a single item, or fetches the whole dataset. Additionally add global data which is currently only used for .replay(). .replay() should enable the user to run the last command in any buffer, not only in .http or .rest buffers.
- Loading branch information
1 parent
ee83f98
commit 321170b
Showing
2 changed files
with
25 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
local DB = require("kulala.db") | ||
|
||
describe("db scoped", function() | ||
it("should not leak into other buffers", function() | ||
vim.cmd("new") | ||
local buf1 = vim.api.nvim_get_current_buf() | ||
DB.update().key1 = "value1" | ||
assert.equal(DB.find_unique("key1"), "value1") | ||
|
||
vim.cmd("new") | ||
local buf2 = vim.api.nvim_get_current_buf() | ||
DB.update().key2 = "value2" | ||
assert.equal(DB.find_unique("key1"), nil) | ||
assert.equal(DB.find_unique("key2"), "value2") | ||
|
||
vim.api.nvim_set_current_buf(buf1) | ||
assert.equal(DB.find_unique("key1"), "value1") | ||
assert.equal(DB.find_unique("key2"), nil) | ||
|
||
vim.api.nvim_set_current_buf(buf2) | ||
assert.equal(DB.find_unique("key1"), nil) | ||
assert.equal(DB.find_unique("key2"), "value2") | ||
end) | ||
end) |