-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrna-transcription.spec.js
44 lines (35 loc) · 1.18 KB
/
rna-transcription.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import Transcriptor from './rna-transcription';
describe('Transcriptor', () => {
const transcriptor = new Transcriptor();
test('transcribes cytosine to guanine', () => {
expect(transcriptor.toRna('C')).toEqual('G');
});
test('transcribes guanine to cytosine', () => {
expect(transcriptor.toRna('G')).toEqual('C');
});
test('transcribes adenine to uracil', () => {
expect(transcriptor.toRna('A')).toEqual('U');
});
test('transcribes thymine to adenine', () => {
expect(transcriptor.toRna('T')).toEqual('A');
});
test('transcribes all dna nucleotides to their rna complements', () => {
expect(transcriptor.toRna('ACGTGGTCTTAA'))
.toEqual('UGCACCAGAAUU');
});
test('correctly handles invalid input', () => {
expect(() => transcriptor.toRna('U')).toThrow(
new Error('Invalid input DNA.'),
);
});
test('correctly handles completely invalid input', () => {
expect(() => transcriptor.toRna('XXX')).toThrow(
new Error('Invalid input DNA.'),
);
});
test('correctly handles partially invalid input', () => {
expect(() => transcriptor.toRna('ACGTXXXCTTAA')).toThrow(
new Error('Invalid input DNA.'),
);
});
});