Skip to content

Commit

Permalink
add tests for checking name property after ligating and adding crosso…
Browse files Browse the repository at this point in the history
…vers to same type strands
  • Loading branch information
sarahayu committed Jan 14, 2022
1 parent 7587bc7 commit 1104584
Showing 1 changed file with 116 additions and 0 deletions.
116 changes: 116 additions & 0 deletions test/assign_strand_name_unit_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,122 @@ main() {
expect(all_strands.length, 1);
});


test('ligate__both_named__both_staple__first_strand_clicked', () {
var helices = [Helix(idx: 0, max_offset: 20, grid: Grid.square)];
var design = Design(helices: helices, grid: Grid.square);

design = design.strand(0,0).move(8).with_name("ABC").commit();
design = design.strand(0,8).move(8).with_name("XYZ").commit();

var action = actions.Ligate(dna_end: design.strands[0].dnaend_3p);
var state = app_state_from_design(design);
var all_strands = ligate_reducer(design.strands, state, action);

expect(all_strands[0].name, "ABC");
expect(all_strands.length, 1);
});
test('ligate__both_named__both_staple__second_strand_clicked', () {
var helices = [Helix(idx: 0, max_offset: 20, grid: Grid.square)];
var design = Design(helices: helices, grid: Grid.square);

design = design.strand(0,0).move(8).with_name("ABC").commit();
design = design.strand(0,8).move(8).with_name("XYZ").commit();

var action = actions.Ligate(dna_end: design.strands[1].dnaend_5p);
var state = app_state_from_design(design);
var all_strands = ligate_reducer(design.strands, state, action);

expect(all_strands[0].name, "XYZ");
expect(all_strands.length, 1);
});
test('crossover__both_named__both_staple__first_strand_clicked', () {
var helices = [Helix(idx: 0, max_offset: 20, grid: Grid.square)];
var design = Design(helices: helices, grid: Grid.square);

design = design.strand(0,0).move(8).with_name("ABC").commit();
design = design.strand(0,8).move(-8).with_name("XYZ").commit();

var action =
actions.JoinStrandsByCrossover(dna_end_first_click: design.strands[0].dnaend_3p, dna_end_second_click: design.strands[1].dnaend_5p);
var state = app_state_from_design(design);
var all_strands = join_strands_by_crossover_reducer(design.strands, state, action);

expect(all_strands[0].name, "ABC");
expect(all_strands.length, 1);
});
test('crossover__both_named__both_staple__second_strand_clicked', () {
var helices = [Helix(idx: 0, max_offset: 20, grid: Grid.square)];
var design = Design(helices: helices, grid: Grid.square);

design = design.strand(0,0).move(8).with_name("ABC").commit();
design = design.strand(0,8).move(-8).with_name("XYZ").commit();

var action =
actions.JoinStrandsByCrossover(dna_end_first_click: design.strands[1].dnaend_3p, dna_end_second_click: design.strands[0].dnaend_5p);
var state = app_state_from_design(design);
var all_strands = join_strands_by_crossover_reducer(design.strands, state, action);

expect(all_strands[0].name, "XYZ");
expect(all_strands.length, 1);
});
test('ligate__both_named__both_scaffold__first_strand_clicked', () {
var helices = [Helix(idx: 0, max_offset: 20, grid: Grid.square)];
var design = Design(helices: helices, grid: Grid.square);

design = design.strand(0,0).move(8).with_name("ABC").as_scaffold().commit();
design = design.strand(0,8).move(8).with_name("XYZ").as_scaffold().commit();

var action = actions.Ligate(dna_end: design.strands[0].dnaend_3p);
var state = app_state_from_design(design);
var all_strands = ligate_reducer(design.strands, state, action);

expect(all_strands[0].name, "ABC");
expect(all_strands.length, 1);
});
test('ligate__both_named__both_scaffold__second_strand_clicked', () {
var helices = [Helix(idx: 0, max_offset: 20, grid: Grid.square)];
var design = Design(helices: helices, grid: Grid.square);

design = design.strand(0,0).move(8).with_name("ABC").as_scaffold().commit();
design = design.strand(0,8).move(8).with_name("XYZ").as_scaffold().commit();

var action = actions.Ligate(dna_end: design.strands[1].dnaend_5p);
var state = app_state_from_design(design);
var all_strands = ligate_reducer(design.strands, state, action);

expect(all_strands[0].name, "XYZ");
expect(all_strands.length, 1);
});
test('crossover__both_named__both_scaffold__first_strand_clicked', () {
var helices = [Helix(idx: 0, max_offset: 20, grid: Grid.square)];
var design = Design(helices: helices, grid: Grid.square);

design = design.strand(0,0).move(8).with_name("ABC").as_scaffold().commit();
design = design.strand(0,8).move(-8).with_name("XYZ").as_scaffold().commit();

var action =
actions.JoinStrandsByCrossover(dna_end_first_click: design.strands[0].dnaend_3p, dna_end_second_click: design.strands[1].dnaend_5p);
var state = app_state_from_design(design);
var all_strands = join_strands_by_crossover_reducer(design.strands, state, action);

expect(all_strands[0].name, "ABC");
expect(all_strands.length, 1);
});
test('crossover__both_named__both_scaffold__second_strand_clicked', () {
var helices = [Helix(idx: 0, max_offset: 20, grid: Grid.square)];
var design = Design(helices: helices, grid: Grid.square);

design = design.strand(0,0).move(8).with_name("ABC").as_scaffold().commit();
design = design.strand(0,8).move(-8).with_name("XYZ").as_scaffold().commit();

var action =
actions.JoinStrandsByCrossover(dna_end_first_click: design.strands[1].dnaend_3p, dna_end_second_click: design.strands[0].dnaend_5p);
var state = app_state_from_design(design);
var all_strands = join_strands_by_crossover_reducer(design.strands, state, action);

expect(all_strands[0].name, "XYZ");
expect(all_strands.length, 1);
});
});
}

0 comments on commit 1104584

Please sign in to comment.