-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] made user have GenericFields - for tags, etc
[FEAT] added ability to set `issuer_account` on generic claims [TEST] added ability to set where nsc stores/reads files for cross lib checks [DENO] added a deno.json/lock simplifying std imports [LINT] fixed linter warnings
- Loading branch information
Showing
10 changed files
with
352 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"imports": { | ||
"std/": "https://deno.land/std@0.177.0/" | ||
}, | ||
"lint": { | ||
"files": { | ||
"exclude": ["docs/", "lib/", "esm/jwt.js", "debug/", "cjs/", "cjs_src/"] | ||
} | ||
}, | ||
"fmt": { | ||
"files": { | ||
"exclude": ["docs/", "lib/", "esm/jwt.js", "debug/", "cjs/", "cjs_src/"] | ||
} | ||
} | ||
} |
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
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,100 @@ | ||
import { | ||
getConfigHome, | ||
getKeysDir, | ||
getStoresDir, | ||
nsc, | ||
parseTable, | ||
setNKeysDir, | ||
setNscConfig, | ||
setNscData, | ||
} from "./nsc.ts"; | ||
import { | ||
assertEquals, | ||
assertFalse, | ||
} from "https://deno.land/std/testing/asserts.ts"; | ||
import { join } from "https://deno.land/std@0.177.0/path/mod.ts"; | ||
import { assert } from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.7.0-rc/nats-base-client/denobuffer.ts"; | ||
|
||
Deno.test("nsc - env", async () => { | ||
const std = await nsc.env(); | ||
const table = parseTable(std.err); | ||
const nscHome = table.find((v) => { | ||
return v[0] === "$NSC_HOME"; | ||
})?.[2]; | ||
assertEquals(nscHome, join(getConfigHome(), "nats", "nsc")); | ||
|
||
const nkeys = table.find((v) => { | ||
return v[0] === "$NKEYS_PATH"; | ||
}); | ||
const nkeysPath = nkeys?.[2]; | ||
assertEquals(nkeysPath, getKeysDir()); | ||
const nkeysPathSet = nkeys?.[1] === "Yes" || false; | ||
assertFalse(nkeysPathSet); | ||
|
||
const storeDir = table.find((v) => { | ||
return v[0] === "Default Stores Dir"; | ||
})?.[2]; | ||
assertEquals(storeDir, getStoresDir()); | ||
}); | ||
|
||
Deno.test("nsc - set env nkeys_path", async () => { | ||
const dir = await Deno.makeTempDir({ prefix: "my_test_" }); | ||
setNscData(join(dir, "data")); | ||
setNscConfig(join(dir, "config")); | ||
const nkeysDir = join(dir, "this_are_my_keys"); | ||
setNKeysDir(nkeysDir); | ||
|
||
const std = await nsc.env(); | ||
const table = parseTable(std.err); | ||
const nscHome = table.find((v) => { | ||
return v[0] === "$NSC_HOME"; | ||
})?.[2]; | ||
assertEquals(nscHome, join(getConfigHome(), "nats", "nsc")); | ||
assert(nscHome?.includes("my_test_")); | ||
|
||
const nkeys = table.find((v) => { | ||
return v[0] === "$NKEYS_PATH"; | ||
}); | ||
const nkeysPath = nkeys?.[2]; | ||
assertEquals(nkeysPath, nkeysDir); | ||
assert(nkeysPath?.includes("my_test_")); | ||
|
||
const nkeysPathSet = nkeys?.[1] === "Yes" || false; | ||
assert(nkeysPathSet); | ||
|
||
const storeDir = table.find((v) => { | ||
return v[0] === "Default Stores Dir"; | ||
})?.[2]; | ||
assertEquals(storeDir, getStoresDir()); | ||
assert(storeDir?.includes("my_test_")); | ||
}); | ||
|
||
Deno.test("nsc - set nkeys dir", async () => { | ||
const dir = await Deno.makeTempDir({ prefix: "my_test_" }); | ||
setNscData(join(dir, "data")); | ||
setNscConfig(join(dir, "config")); | ||
|
||
const std = await nsc.env(); | ||
const table = parseTable(std.err); | ||
const nscHome = table.find((v) => { | ||
return v[0] === "$NSC_HOME"; | ||
})?.[2]; | ||
assertEquals(nscHome, join(getConfigHome(), "nats", "nsc")); | ||
assert(nscHome?.includes("my_test_")); | ||
|
||
const nkeys = table.find((v) => { | ||
return v[0] === "$NKEYS_PATH"; | ||
}); | ||
const nkeysPath = nkeys?.[2]; | ||
assertEquals(nkeysPath, getKeysDir()); | ||
assert(nkeysPath?.includes("my_test_")); | ||
|
||
const nkeysPathSet = nkeys?.[1] === "Yes" || false; | ||
assert(nkeysPathSet); | ||
|
||
const storeDir = table.find((v) => { | ||
return v[0] === "Default Stores Dir"; | ||
})?.[2]; | ||
assertEquals(storeDir, getStoresDir()); | ||
assert(storeDir?.includes("my_test_")); | ||
}); |