Skip to content

Commit

Permalink
test: update tests based on MagicalIndexer fix (70028f2)
Browse files Browse the repository at this point in the history
  • Loading branch information
kekavc24 committed Mar 6, 2024
1 parent 70028f2 commit 3b0f80f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void main() {
orderType: OrderType.loose,
);

final finder = ValueFinder.findInMap(
final finder = ValueFinder.findInDynamicValue(
defaultMap,
saveCounterToHistory: false,
keysToFind: keysToFind,
Expand Down Expand Up @@ -51,7 +51,7 @@ void main() {
orderType: OrderType.grouped,
);

final finder = ValueFinder.findInMap(
final finder = ValueFinder.findInDynamicValue(
defaultMap,
saveCounterToHistory: false,
keysToFind: keysToFind,
Expand All @@ -78,7 +78,7 @@ void main() {
orderType: OrderType.strict,
);

final finder = ValueFinder.findInMap(
final finder = ValueFinder.findInDynamicValue(
defaultMap,
saveCounterToHistory: false,
keysToFind: keysToFind,
Expand All @@ -104,7 +104,7 @@ void main() {
test(
'when at root, nested in key with list or a value to a key in map',
() {
final finder = ValueFinder.findInMap(
final finder = ValueFinder.findInDynamicValue(
defaultMap,
saveCounterToHistory: false,
keysToFind: null,
Expand Down Expand Up @@ -134,7 +134,7 @@ void main() {
'anotherKey': 'key',
};

final finder = ValueFinder.findInMap(
final finder = ValueFinder.findInDynamicValue(
defaultMap,
saveCounterToHistory: false,
keysToFind: null,
Expand Down Expand Up @@ -176,7 +176,7 @@ void main() {
'key': 'value',
};

final finder = ValueFinder.findInMap(
final finder = ValueFinder.findInDynamicValue(
defaultMap,
saveCounterToHistory: false,
keysToFind: null,
Expand Down Expand Up @@ -232,7 +232,7 @@ void main() {
'keyWithList': 'key',
};

final finder = ValueFinder.findInMap(
final finder = ValueFinder.findInDynamicValue(
defaultMap,
saveCounterToHistory: false,
keysToFind: keysToFind,
Expand Down Expand Up @@ -278,7 +278,7 @@ void main() {
'keyWithList': 'key',
};

final finder = ValueFinder.findInMap(
final finder = ValueFinder.findInDynamicValue(
defaultMap,
saveCounterToHistory: false,
keysToFind: keysToFind,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void main() {
final map = {'key': 'value'};

// Index it
final node = MagicalIndexer.forDartMap(map).indexYaml().first;
final node = MagicalIndexer.forDartMap(map).index().first;

expect(node.toString(), 'key/value');
});
Expand All @@ -19,7 +19,7 @@ void main() {

// Index & get paths
final nodes = MagicalIndexer.forDartMap(map)
.indexYaml()
.index()
.toList()
.map((node) => node.toString());

Expand All @@ -32,7 +32,7 @@ void main() {
};

// Index it
final node = MagicalIndexer.forDartMap(map).indexYaml().first;
final node = MagicalIndexer.forDartMap(map).index().first;

expect(node.toString(), 'key/nestedKey/value');
});
Expand All @@ -45,7 +45,7 @@ void main() {

// Index it
final nodes = MagicalIndexer.forDartMap(map)
.indexYaml()
.index()
.toList()
.map((node) => node.toString());

Expand All @@ -62,7 +62,7 @@ void main() {
'key': ['value', 'anotherValue'],
};

final nodes = MagicalIndexer.forDartMap(map).indexYaml().toList();
final nodes = MagicalIndexer.forDartMap(map).index().toList();

// Expected nodes
final expectedNodes = [
Expand All @@ -88,7 +88,7 @@ void main() {
],
};

final node = MagicalIndexer.forDartMap(map).indexYaml().first;
final node = MagicalIndexer.forDartMap(map).index().first;

// Key will be at index 0. Index goes to key rather than value
final expectedNode = NodeData.skeleton(
Expand All @@ -107,7 +107,7 @@ void main() {
],
};

final node = MagicalIndexer.forDartMap(map).indexYaml().first;
final node = MagicalIndexer.forDartMap(map).index().first;

// Index goes to value rather than key
final expectedNode = NodeData.skeleton(
Expand Down Expand Up @@ -135,7 +135,7 @@ void main() {

final rootKey = createPair<Key>(value: 'key');

final nodes = MagicalIndexer.forDartMap(map).indexYaml().toList();
final nodes = MagicalIndexer.forDartMap(map).index().toList();

// Expected nodes
final expectedNodes = [
Expand Down Expand Up @@ -177,14 +177,13 @@ void main() {
});

group('indexer for yaml', () {
YamlMap createMap(String yaml) => loadYaml(yaml) as YamlMap;

test('indexes simple yaml string', () {
const yaml = 'key: value';

final node = MagicalIndexer.forYaml(
createMap(yaml),
).indexYaml().toList().first;
final node = MagicalIndexer.forDynamicValue(
loadYaml(yaml),
).index().toList().first;

expect(node.toString(), 'key/value');
});
Expand All @@ -200,9 +199,9 @@ void main() {
- third
''';

final nodePaths = MagicalIndexer.forYaml(
createMap(yaml),
).indexYaml().toList().map((e) => e.toString());
final nodePaths = MagicalIndexer.forDynamicValue(
loadYaml(yaml),
).index().toList().map((e) => e.toString());

final expectedPaths = [
'root/value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void main() {

setUp(() {
yamlMap = YamlMap.wrap(map);
nodes = MagicalIndexer.forDartMap(map).indexYaml().toList();
nodes = MagicalIndexer.forDartMap(map).index().toList();
keySwapper = KeySwapper(
{
'replacedKeyAtRoot': ['normalKey'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void main() {

setUp(() {
yamlMap = YamlMap.wrap(map);
nodes = MagicalIndexer.forDartMap(map).indexYaml().toList();
nodes = MagicalIndexer.forDartMap(map).index().toList();
valueReplacer = ValueReplacer({
'replacedValue': ['value'],
});
Expand Down

0 comments on commit 3b0f80f

Please sign in to comment.