This repository has been archived by the owner on Dec 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 21602a9
Showing
3 changed files
with
46 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
TESTS_INIT=tests/minimal_init.lua | ||
TESTS_DIR=tests/ | ||
|
||
.EXPORT_ALL_VARIABLES: | ||
|
||
PROJECT_ENV = test | ||
|
||
.PHONY: test | ||
|
||
test: | ||
@nvim \ | ||
--headless \ | ||
--noplugin \ | ||
-u ${TESTS_INIT} \ | ||
-c "PlenaryBustedDirectory ${TESTS_DIR} { minimal_init = '${TESTS_INIT}' }" |
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,14 @@ | ||
local plenary_dir = os.getenv("PLENARY_DIR") or "/tmp/plenary.nvim" | ||
local is_not_a_directory = vim.fn.isdirectory(plenary_dir) == 0 | ||
if is_not_a_directory then | ||
vim.fn.system({ "git", "clone", "https://github.com/nvim-lua/plenary.nvim", plenary_dir }) | ||
end | ||
|
||
vim.opt.rtp:append(".") | ||
vim.opt.rtp:append(plenary_dir) | ||
|
||
vim.cmd("runtime plugin/plenary.vim") | ||
require("plenary.busted") | ||
|
||
|
||
-- please ensure that lua-openssl is installed via luarocks |
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,17 @@ | ||
local cipher = require('openssl').cipher | ||
|
||
describe('utils', function() | ||
it("encryption is successful", function() | ||
local original = { | ||
env = { OPEN_API_KEY = "blahblahblah" } | ||
} | ||
local cipher_algorithm = "aes-128-cbc" | ||
local json_encoded = vim.fn.json_encode(original) | ||
local encryption_key = "aaabbb111" | ||
local encrypted_content = cipher.encrypt(cipher_algorithm, json_encoded, encryption_key) | ||
local decrypted_content = cipher.decrypt(cipher_algorithm, encrypted_content, encryption_key) | ||
assert(json_encoded == decrypted_content) | ||
end) | ||
end) | ||
|
||
|