-
Notifications
You must be signed in to change notification settings - Fork 5
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
99cd689
commit 389e06a
Showing
4 changed files
with
101 additions
and
97 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 |
---|---|---|
@@ -1,15 +1,61 @@ | ||
import os from 'os'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import Logger, { LogLevel, StreamHandler } from '@matrixai/logger'; | ||
import { DB } from '@matrixai/db'; | ||
import KeyManager from '@/keys/KeyManager'; | ||
import Queue from '@/queue/Queue'; | ||
import * as keysUtils from '@/keys/utils'; | ||
import { globalRootKeyPems } from '../fixtures/globalRootKeyPems'; | ||
|
||
if (require.main == null) { | ||
describe(Queue.name, () => { | ||
const logger = new Logger(`${Queue.name} test`, LogLevel.WARN, [ | ||
new StreamHandler(), | ||
]); | ||
test('do it', async () => { | ||
console.log('wee'); | ||
describe(Queue.name, () => { | ||
const password = 'password'; | ||
const logger = new Logger(`${Queue.name} test`, LogLevel.WARN, [ | ||
new StreamHandler(), | ||
]); | ||
let keyManager: KeyManager; | ||
let dbKey: Buffer; | ||
let dbPath: string; | ||
let db: DB; | ||
beforeAll(async () => { | ||
dataDir = await fs.promises.mkdtemp( | ||
path.join(os.tmpdir(), 'polykey-test-'), | ||
); | ||
const keysPath = `${dataDir}/keys`; | ||
keyManager = await KeyManager.createKeyManager({ | ||
password, | ||
keysPath, | ||
logger, | ||
privateKeyPemOverride: globalRootKeyPems[0], | ||
}); | ||
dbKey = await keysUtils.generateKey(); | ||
dbPath = `${dataDir}/db`; | ||
}); | ||
} | ||
beforeEach(async () => { | ||
db = await DB.createDB({ | ||
dbPath, | ||
logger, | ||
crypto: { | ||
key: dbKey, | ||
ops: { | ||
encrypt: keysUtils.encryptWithKey, | ||
decrypt: keysUtils.decryptWithKey, | ||
}, | ||
}, | ||
}); | ||
}); | ||
afterEach(async () => { | ||
await db.stop(); | ||
await db.destroy(); | ||
}); | ||
test('do it', async () => { | ||
const queue = await Queue.createQueue({ | ||
db, | ||
keyManager, | ||
logger, | ||
}); | ||
|
||
export default 3; | ||
await queue.stop(); | ||
await queue.destroy(); | ||
}); | ||
}); |