wasp/waspc/test/SemanticVersionTest.hs
Filip Sodić 8a3fba8831
Require LTS version of Node for Wasp (#504)
* Require LTS node and npm on client and server

* Update node and npm versions in the docs

* Add npmrc and nvmrc to WebAppGenerator

* Change function name in test

* Add newline to nvmrc

* Add newline to Common.hs

* Remove extra empty line in nvmrc

* Remove extra empty line in Common.hs

* Update end to end tests for node LTS

* Add newline at the end of server/nvmrc

* Ensure Node version 16 in CI

* Fix broken ci file

* Change how Wasp specifies required versions

* Fix formatting

* Use type alias for semantic versions

* Remove incorrect comment on Prisma LTS

* Update e2e checksums

* Fix typo in gitignore

Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>

* Sort e2e checksums

* Extract semantic version to its module

* Fix formatting

* Fix formatting again

* Add comment explaining nvmrc

* Add tests and change semver naming

* Add natural numbers and formatting to semver

* Add newline at the end of semver module

* Add missing space to node mismatch message

Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>
2022-03-21 15:00:19 +01:00

40 lines
1.8 KiB
Haskell

module SemanticVersionTest where
import Test.Tasty.Hspec
import Wasp.SemanticVersion
spec_isVersionInBounds :: Spec
spec_isVersionInBounds = do
it "Correctly determines satisfied exact version bounds" $
Version 1 2 3 `isVersionInBounds` Exact (Version 1 2 3)
it "Correctly determines unsatisfied exact version bounds" $
not $
any
(`isVersionInBounds` Exact (Version 1 2 3))
[Version 2 2 3, Version 1 3 3, Version 1 2 4]
it "Correctly determine satisfied backwards compatible version bounds" $
all
(`isVersionInBounds` BackwardsCompatibleWith (Version 1 2 3))
[Version 1 2 3, Version 1 2 4, Version 1 3 0]
it "Correctly determines unsatisfied backwards compatible version bounds" $
not $
any
(`isVersionInBounds` BackwardsCompatibleWith (Version 1 2 3))
[Version 1 2 0, Version 1 2 2, Version 2 0 0]
it "Correctly determines satisfied backwards compatible version bounds with 0.x versions" $
all
(`isVersionInBounds` BackwardsCompatibleWith (Version 0 2 3))
[Version 0 2 3, Version 0 2 4]
it "Correctly determines unsatisfied backwards compatible version bounds with 0.x versions" $
not $
any
(`isVersionInBounds` BackwardsCompatibleWith (Version 0 2 3))
[Version 0 0 0, Version 0 1 3, Version 0 2 0, Version 0 2 2, Version 0 3 0, Version 1 0 0]
it "Correctly determines satisfied backwards compatible version bounds with 0.0.x versions" $
Version 0 0 2 `isVersionInBounds` BackwardsCompatibleWith (Version 0 0 2)
it "Correctly determines unsatisfied backwards compatible version bounds with 0.0.x versions" $
not $
any
(`isVersionInBounds` BackwardsCompatibleWith (Version 0 0 2))
[Version 0 0 1, Version 0 0 3, Version 0 1 0, Version 1 0 0]