mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2025-09-05 17:00:39 +00:00
test files in cli and cross with password
This commit is contained in:
33
test/cli/file/simple.spec.ts
Normal file
33
test/cli/file/simple.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { test } from '@playwright/test'
|
||||
import { basename } from 'node:path'
|
||||
import { Files, getFileChecksum, rm, tmpFile } from '../../files'
|
||||
import { CLI, getLinkFromCLI } from '../../utils'
|
||||
|
||||
test.describe('file @cli', () => {
|
||||
test('simple', async ({ page }) => {
|
||||
const file = await tmpFile(Files.Image)
|
||||
const checksum = await getFileChecksum(file)
|
||||
const note = await CLI('send', 'file', file)
|
||||
const link = getLinkFromCLI(note.stdout)
|
||||
await rm(file)
|
||||
|
||||
await CLI('open', link, '--all')
|
||||
const c = await getFileChecksum(basename(file))
|
||||
await rm(basename(file))
|
||||
test.expect(checksum).toBe(c)
|
||||
})
|
||||
|
||||
test('simple with password', async ({ page }) => {
|
||||
const file = await tmpFile(Files.Image)
|
||||
const password = 'password'
|
||||
const checksum = await getFileChecksum(file)
|
||||
const note = await CLI('send', 'file', file, '--password', password)
|
||||
const link = getLinkFromCLI(note.stdout)
|
||||
await rm(file)
|
||||
|
||||
await CLI('open', link, '--all', '--password', password)
|
||||
const c = await getFileChecksum(basename(file))
|
||||
await rm(basename(file))
|
||||
test.expect(checksum).toBe(c)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user