Files
adopt-a-street/node_modules/mpath/test/stringToParts.js
William Valentin 5aca521c52 feat: Complete CouchDB migration and Docker configuration
- Add comprehensive CouchDB setup and configuration
- Update Docker files for CouchDB compatibility
- Create Kubernetes manifests for CouchDB deployment
- Add migration scripts and documentation
- Update seeding scripts to support both CouchDB and MongoDB
- Add docker-compose for local development
- Create comprehensive setup and deployment guides

🤖 Generated with [AI Assistant]

Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
2025-11-01 13:32:39 -07:00

30 lines
1.0 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', '']);
});
});