mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00

* chore: Switch to Node 20 + Vitest * chore: migrate to vitest mock functions * chore: code style (switch to prettier) * test: re-enable long-running test Seems the switch to Node 20 and Vitest has vastly improved the code's and / or the test's runtime! see #1193 * chore: code style * chore: fix failing tests * Updated Documentation in README.md * Update contribution guidelines to state usage of Prettier * fix: set prettier printWidth back to 80 * chore: apply updated code style automatically * fix: set prettier line endings to lf again * chore: apply updated code style automatically --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
107 lines
2.8 KiB
JavaScript
107 lines
2.8 KiB
JavaScript
import * as tc from '../TemperatureConversion.js'
|
|
|
|
describe('Testing Conversion of Celsius to fahrenheit', () => {
|
|
it('with celsius value', () => {
|
|
const test1 = tc.celsiusToFahrenheit(10)
|
|
expect(test1).toBe(50)
|
|
})
|
|
})
|
|
|
|
describe('Testing Conversion of Celsius to kelvin', () => {
|
|
it('with celsius value', () => {
|
|
const test1 = tc.celsiusToKelvin(15)
|
|
expect(test1).toBe(288)
|
|
})
|
|
})
|
|
|
|
describe('Testing Conversion of Celsius to Rankine', () => {
|
|
it('with celsius value', () => {
|
|
const test1 = tc.celsiusToRankine(28)
|
|
expect(test1).toBe(542)
|
|
})
|
|
})
|
|
|
|
describe('Testing Conversion of Fahrenheit to Celsius', () => {
|
|
it('with Fahrenheit value', () => {
|
|
const test1 = tc.fahrenheitToCelsius(134)
|
|
expect(test1).toBe(57)
|
|
})
|
|
})
|
|
|
|
describe('Testing Conversion of Fahrenheit to Kelvin', () => {
|
|
it('with Fahrenheit value', () => {
|
|
const test1 = tc.fahrenheitToKelvin(125)
|
|
expect(test1).toBe(325)
|
|
})
|
|
})
|
|
|
|
describe('Testing Conversion of Fahrenheit to Rankine', () => {
|
|
it('with Fahrenheit value', () => {
|
|
const test1 = tc.fahrenheitToRankine(10)
|
|
expect(test1).toBe(470)
|
|
})
|
|
})
|
|
|
|
describe('Testing Conversion of Kelvin to Celsius', () => {
|
|
it('with Kelvin value', () => {
|
|
const test1 = tc.kelvinToCelsius(100)
|
|
expect(test1).toBe(-173)
|
|
})
|
|
})
|
|
|
|
describe('Testing Conversion of Kelvin to Fahrenheit', () => {
|
|
it('with Kelvin value', () => {
|
|
const test1 = tc.kelvinToFahrenheit(20)
|
|
expect(test1).toBe(-424)
|
|
})
|
|
})
|
|
|
|
describe('Testing Conversion of Kelvin to Rankine', () => {
|
|
it('with kelvin value', () => {
|
|
const test1 = tc.kelvinToRankine(69)
|
|
expect(test1).toBe(124)
|
|
})
|
|
})
|
|
describe('Testing Conversion of Rankine to Celsius', () => {
|
|
it('with Rankine value', () => {
|
|
const test1 = tc.rankineToCelsius(234)
|
|
expect(test1).toBe(-143)
|
|
})
|
|
})
|
|
describe('Testing Conversion of Rankine to Fahrenheit', () => {
|
|
it('with Rankine value', () => {
|
|
const test1 = tc.rankineToFahrenheit(98)
|
|
expect(test1).toBe(-362)
|
|
})
|
|
})
|
|
describe('Testing Conversion of Rankine to Kelvin', () => {
|
|
it('with Rankine value', () => {
|
|
const test1 = tc.rankineToKelvin(10)
|
|
expect(test1).toBe(6)
|
|
})
|
|
})
|
|
describe('Testing Conversion of Reaumur to Celsius', () => {
|
|
it('with Reaumur value', () => {
|
|
const test1 = tc.reaumurToCelsius(100)
|
|
expect(test1).toBe(125)
|
|
})
|
|
})
|
|
describe('Testing Conversion of Reaumur to Fahrenheit', () => {
|
|
it('with Reaumur value', () => {
|
|
const test1 = tc.reaumurToFahrenheit(100)
|
|
expect(test1).toBe(257)
|
|
})
|
|
})
|
|
describe('Testing Conversion of Reaumur to Kelvin', () => {
|
|
it('with Reamur value', () => {
|
|
const test1 = tc.reaumurToKelvin(100)
|
|
expect(test1).toBe(398)
|
|
})
|
|
})
|
|
describe('Testing Conversion of Reamur to Rankine', () => {
|
|
it('with Reamur value', () => {
|
|
const test1 = tc.reaumurToRankine(100)
|
|
expect(test1).toBe(717)
|
|
})
|
|
})
|