-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automated Testing Setup #1
Comments
{ "Paddy_seeds_scheme_pesticide": { "Paddy_seeds_variety_scheme": { } |
PR Raised here |
QA tests it => if regression found add it to the test cases PR. |
Hey @Amruth-Vamshi sharing a gist here.
type Node = string;
type WeightedEdge = [Node, Node, number];
interface Graph {
[key: string]: { [key: string]: number };
}
class Parser {
private diagram: string;
constructor(diagram: string) {
this.diagram = diagram;
}
private parse(): WeightedEdge[] {
const edges = this.diagram.split("\n").filter(line => line.includes('--'));
return edges.map(edge => {
const [from, toWithWeight] = edge.split('--');
const [to, weight] = toWithWeight.split('%-->');
return [from.trim(), to.trim(), Number(weight) / 100];
});
}
public toGraph(): Graph {
const graph: Graph = {};
const edges = this.parse();
for (const [from, to, weight] of edges) {
if (!(from in graph)) {
graph[from] = {};
}
graph[from][to] = weight;
}
return graph;
}
}
class Walker {
private graph: Graph;
constructor(graph: Graph) {
this.graph = graph;
}
public walk(start: Node): void {
let currentNode = start;
while (true) {
console.log(currentNode);
const neighbors = this.graph[currentNode];
if (!neighbors) {
break;
}
const neighborsArr = Object.keys(neighbors);
const weights = neighborsArr.map(neighbor => neighbors[neighbor]);
let choice = this.weightedRandom(neighborsArr, weights);
currentNode = choice;
}
}
private weightedRandom(options: string[], weights: number[]): string {
let i, pickedIndex,
totalWeight = weights.reduce((prev, curr) => prev + curr, 0);
let randomNum = Math.random() * totalWeight;
for (i = 0; i < options.length; i++) {
randomNum -= weights[i];
if (randomNum < 0) {
pickedIndex = i;
break;
}
}
return options[pickedIndex];
}
}
// Create a new parser and parse the mermaid diagram
const diagram = `
graph TD;
A[Define Problem]--100%-->B[Collect Human Feedback];
B--100%-->C[Preprocess Human Feedback];
C--100%-->D[Train Initial RL Agent];
D--100%-->E[Fine-tune with RL];
E--100%-->A[Evaluate and Iterate];
`;
const parser = new Parser(diagram);
const graph = parser.toGraph();
// Create a new walker and walk through the graph
const walker = new Walker(graph);
walker.walk("A[Define Problem]"); |
/app/e2e/flow
and add flows asflow-x
where x is the actual test case name.The text was updated successfully, but these errors were encountered: