crypstie3-node/test/live.test.js

28 lines
898 B
JavaScript

'use strict';
const assert = require('node:assert/strict');
const test = require('node:test');
const { createCrypstie, openCrypstie } = require('../src');
test(
'opens a reusable Crypstie from the deployed service',
{ skip: !process.env.CRYPSTIE_TEST_URL },
async () => {
const result = await openCrypstie(process.env.CRYPSTIE_TEST_URL);
assert.match(result.text, /^Crypstie Node compatibility fixture /);
assert.equal(result.burnOnShow, false);
},
);
test(
'creates and reopens a reusable Crypstie on the deployed service',
{ skip: process.env.CRYPSTIE_LIVE_WRITE !== '1' },
async () => {
const marker = `Crypstie Node compatibility fixture ${new Date().toISOString()}`;
const created = await createCrypstie(marker);
const opened = await openCrypstie(created.url);
assert.equal(opened.text, marker);
assert.equal(opened.burnOnShow, false);
},
);