Multiple exercises were added to the TypeScript track in this commit.

This commit is contained in:
2025-04-16 21:10:33 +02:00
parent e0d01e1c8d
commit 83ec49cb5b
72 changed files with 81869 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
import { describe, it, expect, xit } from '@jest/globals'
import { nucleotideCounts } from './nucleotide-count.ts'
describe('count all nucleotides in a strand', () => {
it('empty strand', () => {
const expected = {
A: 0,
C: 0,
G: 0,
T: 0,
}
expect(nucleotideCounts('')).toEqual(expected)
})
xit('can count one nucleotide in single-character input', () => {
const expected = {
A: 0,
C: 0,
G: 1,
T: 0,
}
expect(nucleotideCounts('G')).toEqual(expected)
})
xit('strand with repeated nucleotide', () => {
const expected = {
A: 0,
C: 0,
G: 7,
T: 0,
}
expect(nucleotideCounts('GGGGGGG')).toEqual(expected)
})
xit('strand with multiple nucleotides', () => {
const expected = {
A: 20,
C: 12,
G: 17,
T: 21,
}
expect(
nucleotideCounts(
'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'
)
).toEqual(expected)
})
xit('strand with invalid nucleotides', () => {
const expected = 'Invalid nucleotide in strand'
expect(() => {
nucleotideCounts('AGXXACT')
}).toThrow(expected)
})
})