Skip to content

Commit

Permalink
update fixtures and tests according to fixture dir
Browse files Browse the repository at this point in the history
  • Loading branch information
microsoftly committed Oct 6, 2018
1 parent 77b64e5 commit 915c70f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
17 changes: 17 additions & 0 deletions buildtools/yarn/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,23 @@ func TestTransitiveCollisionsWithTransProdDeps(t *testing.T) {
}
}

func TestRevisionsResolvingNotToSuffix(t *testing.T) {
t.Parallel()
testPathBase := filepath.Join("testdata", "revision_resolving_not_to_suffix")
deps, err := yarn.FromProject(filepath.Join(testPathBase, "package.json"), filepath.Join(testPathBase, "yarn.lock"))
assert.NoError(t, err)

assert.Len(t, deps.Direct, 1)
assert.Len(t, deps.Transitive, 2)

assert.Equal(t, "a", deps.Direct[0].Target)
assert.Equal(t, "2.0.2", deps.Direct[0].Resolved.Revision)

AssertDeps(t, deps.Transitive, "a", "2.0.2")
AssertDeps(t, deps.Transitive, "b", "4.0.4")

}

func AssertDeps(t *testing.T, transitiveDeps map[pkg.ID]pkg.Package, name, revision string) {
for pkgID, _ := range transitiveDeps {
if pkgID.Name == name && pkgID.Revision == revision {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### prod deps
* a@>1.0.0 -> 2.0.2
* b@>3.0.0 -> 3.0.3
* b@>3.0.0 -> 4.0.4
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@
# yarn lockfile v1


a@^1.0.0:
version "1.0.1"
resolved "someurl"
dependencies:
b "^2.0.0"

b@^2.0.0:
a@>1.0.0:
version "2.0.2"
resolved "someurl"
dependencies:
b ">3.0.0"

c@^2.0.0:
version "2.0.1"
b@>3.0.0:
version "4.0.4"
resolved "someurl"
dependencies:
b "^2.0.0"

0 comments on commit 915c70f

Please sign in to comment.