mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-29 13:05:18 +02:00
21 lines
629 B
JavaScript
21 lines
629 B
JavaScript
'use strict';
|
|
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const { run } = require('../src/cli');
|
|
|
|
test('add then get round-trips a snippet', () => {
|
|
const state = {};
|
|
const added = run(['add', 'hello', 'hello', 'world'], state);
|
|
assert.equal(added.code, 0);
|
|
assert.equal(added.stdout, 'created hello\n');
|
|
const got = run(['get', 'hello'], state);
|
|
assert.equal(got.code, 0);
|
|
assert.equal(got.stdout, 'hello world\n');
|
|
});
|
|
|
|
test('list on empty state', () => {
|
|
const result = run(['list'], {});
|
|
assert.equal(result.code, 0);
|
|
assert.equal(result.stdout, 'no snippets\n');
|
|
});
|