- Add .gitignore: exclude compiled binaries, build artifacts, and Helm values files containing real secrets (authentik, prometheus) - Add all Kubernetes deployment manifests (deployment/) - Add services source code: ha-sync, device-inventory, games-console, paperclip, parts-inventory - Add Ansible orchestration: playbooks, roles, inventory, cloud-init - Add hardware specs, execution plans, scripts, HOMELAB.md - Add skills/homelab/SKILL.md + skills/install.sh to preserve Copilot skill - Remove previously-tracked inventory-cli binary from git index Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
30 lines
No EOL
1 KiB
JavaScript
30 lines
No EOL
1 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('assert');
|
|
const stringToParts = require('../lib/stringToParts');
|
|
|
|
describe('stringToParts', function() {
|
|
it('handles brackets for numbers', function() {
|
|
assert.deepEqual(stringToParts('list[0].name'), ['list', '0', 'name']);
|
|
assert.deepEqual(stringToParts('list[0][1].name'), ['list', '0', '1', 'name']);
|
|
});
|
|
|
|
it('handles dot notation', function() {
|
|
assert.deepEqual(stringToParts('a.b.c'), ['a', 'b', 'c']);
|
|
assert.deepEqual(stringToParts('a..b.d'), ['a', '', 'b', 'd']);
|
|
});
|
|
|
|
it('ignores invalid numbers in square brackets', function() {
|
|
assert.deepEqual(stringToParts('foo[1mystring]'), ['foo[1mystring]']);
|
|
assert.deepEqual(stringToParts('foo[1mystring].bar[1]'), ['foo[1mystring]', 'bar', '1']);
|
|
assert.deepEqual(stringToParts('foo[1mystring][2]'), ['foo[1mystring]', '2']);
|
|
});
|
|
|
|
it('handles empty string', function() {
|
|
assert.deepEqual(stringToParts(''), ['']);
|
|
});
|
|
|
|
it('handles trailing dot', function() {
|
|
assert.deepEqual(stringToParts('a.b.'), ['a', 'b', '']);
|
|
});
|
|
}); |