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)
|
||||
})
|
||||
})
|
@@ -1,13 +1,23 @@
|
||||
import { test } from '@playwright/test'
|
||||
import { CLI } from '../../utils'
|
||||
import { CLI, getLinkFromCLI } from '../../utils'
|
||||
|
||||
test.describe('text @cli', () => {
|
||||
test('simple', async ({ page }) => {
|
||||
const text = `Endless prejudice endless play derive joy eternal-return selfish burying. Of decieve play pinnacle faith disgust. Spirit reason salvation burying strong of joy ascetic selfish against merciful sea truth. Ubermensch moral prejudice derive chaos mountains ubermensch justice philosophy justice ultimate joy ultimate transvaluation. Virtues convictions war ascetic eternal-return spirit. Ubermensch transvaluation noble revaluation sexuality intentions salvation endless decrepit hope noble fearful. Justice ideal ultimate snare god joy evil sexuality insofar gains oneself ideal.`
|
||||
const note = await CLI('send', 'text', text)
|
||||
const link = note.stdout.trim().replace(/(.|\s)*http/g, 'http')
|
||||
const link = getLinkFromCLI(note.stdout)
|
||||
|
||||
const retrieved = await CLI('open', link)
|
||||
test.expect(retrieved.stdout.trim()).toBe(text)
|
||||
})
|
||||
|
||||
test('simple with password', async ({ page }) => {
|
||||
const text = `Endless prejudice endless play derive joy eternal-return selfish burying.`
|
||||
const password = 'password'
|
||||
const note = await CLI('send', 'text', text, '--password', password)
|
||||
const link = getLinkFromCLI(note.stdout)
|
||||
|
||||
const retrieved = await CLI('open', link, '--password', password)
|
||||
test.expect(retrieved.stdout.trim()).toBe(text)
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user