Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

General Changes: dependencies, e2e, blacklist, coverage (#107)

Guilherme Oenning07d89ddd3b39
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6d182faf1..4b00386eb 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -5,7 +5,7 @@ If you know these technologies or would like to learn them, lucky you! This is t
Tools you'll need:
-- Go 1.8+ (https://golang.org)
+- Go 1.9 (https://golang.org)
- Node.js 6+ (https://nodejs.org/)
- Docker (https://www.docker.com/)
- github.com/codegangsta/gin (https://github.com/codegangsta/gin)
@@ -14,9 +14,9 @@ Step by step:
1) clone this repository into `$GOPATH/src/github.com/getfider/fider`
2) run `npm install` to install front end packages
-3) run `npm run build:watch` to pack the front end source into a bundle. It'll
+3) run `npm run watch` to pack the front end source into a bundle on every file change.
4) run `docker-compose up -d pgdev` to start a local PostgreSQL database on Docker.
-5) run `cp .example.env .env` to create a local Environment configuration file.
+5) run `cp .example.env .env` to create a local environment configuration file.
6) run `make watch` to start the application.
7) Navigate to `http://localhost:3000/` and boom! Welcome to your new local Fider development copy!
diff --git a/Gopkg.lock b/Gopkg.lock
index 3605b21e9..182b6fae4 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -17,7 +17,7 @@
branch = "master"
name = "github.com/goenning/letteravatar"
packages = ["."]
- revision = "67f3a5f74e15d5a3ccb9d83859040880c64b118d"
+ revision = "60393e488e6e121fdbc76d32c4f3dba7f3d88377"
[[projects]]
branch = "master"
@@ -148,6 +148,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
- inputs-digest = "85ef71dfcaad35fbc998b5800f62d7b35b976fbb60aafe806a93030d6bd7a6e2"
+ inputs-digest = "8a9e995d9270d7f2907ecd74867c5104f12830eae4a76ce802639457513aa1ed"
solver-name = "gps-cdcl"
solver-version = 1
diff --git a/Makefile b/Makefile
index 80d105441..6c5596141 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ ENV_FILE=.test.env
endif
test:
- godotenv -f ${ENV_FILE} go test $$(go list ./... | grep -v /vendor/) -cover -p=1
+ godotenv -f ${ENV_FILE} go test ./... -cover -p=1
coverage:
godotenv -f ${ENV_FILE} ./cover.sh $$(go list ./... | grep -v /vendor/)
diff --git a/app/pkg/validate/domain.go b/app/pkg/validate/domain.go
index 120ac2227..091a67a67 100644
--- a/app/pkg/validate/domain.go
+++ b/app/pkg/validate/domain.go
@@ -29,8 +29,9 @@ func Subdomain(tenants storage.Tenant, subdomain string) *Result {
switch subdomain {
case
- "signup", "fider", "admin", "setup", "about", "wecanhearyou":
- return Failed([]string{fmt.Sprintf("%s is not a valid subdomain name.", subdomain)})
+ "signup", "fider", "admin", "setup", "about", "wecanhearyou",
+ "billing", "www", "web", "translate", "help", "support", "staging":
+ return Failed([]string{fmt.Sprintf("%s is a reserved subdomain.", subdomain)})
}
available, err := tenants.IsSubdomainAvailable(subdomain)
diff --git a/cover.sh b/cover.sh
index 5532c9b5f..2df771a2d 100755
--- a/cover.sh
+++ b/cover.sh
@@ -45,7 +45,7 @@ for pkg in "$@"; do
args=""
if [[ -n "$coverpkg" ]]; then
- args="-p=1 -coverprofile $COVER/cover.${i}.out -covermode=count -coverpkg $coverpkg,$testcoverpkg"
+ args="-p=1 -coverprofile $COVER/cover.${i}.out -covermode=atomic -coverpkg $coverpkg,$testcoverpkg"
fi
echo go test $args -v -race "$pkg"
diff --git a/package.json b/package.json
index a51719703..0a39b3ae9 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"scripts": {
"build": "rm -rf dist && webpack -p",
"test": "rm -rf output && tsc && mocha -t 30000 output/tsc/tests/**.js",
- "build:watch": "rm -rf dist && webpack --watch",
+ "watch": "rm -rf dist && webpack --watch",
"lint": "tslint public/**/**.tsx public/**/**.ts"
},
"dependencies": {
diff --git a/public/pages/home/IdeaFilter.tsx b/public/pages/home/IdeaFilter.tsx
index 1d745cfbc..d3d7ea10b 100644
--- a/public/pages/home/IdeaFilter.tsx
+++ b/public/pages/home/IdeaFilter.tsx
@@ -17,7 +17,7 @@ const filterers: {[key: string]: (idea: Idea) => boolean} = {
};
const names: {[key: string]: string} = {
- 'recent': 'recent',
+ 'recent': 'recent ideas',
'most-wanted': 'most wanted ideas',
'most-discussed': 'most discussed ideas',
'completed': 'completed ideas',
diff --git a/tests/components/IdeaList.ts b/tests/components/IdeaList.ts
index d13581057..080b035a5 100644
--- a/tests/components/IdeaList.ts
+++ b/tests/components/IdeaList.ts
@@ -6,11 +6,11 @@ export class IdeaList {
}
public async want(index: number) {
- await (await this.elements)[index].findElement(By.css('div.button')).click();
+ await (await this.elements)[index].findElement(By.css('.support-counter .button')).click();
}
public async at(index: number): Promise<WebComponent> {
- const selector = 'div.statistic div.value';
+ const selector = '.support-counter .button';
const counter = (await this.elements)[index].findElement(By.css(selector));
return new WebComponent(counter, selector);
}
diff --git a/tests/pages/FacebookSignInPage.ts b/tests/pages/FacebookSignInPage.ts
index e6c2c8a75..4de3e9ba5 100644
--- a/tests/pages/FacebookSignInPage.ts
+++ b/tests/pages/FacebookSignInPage.ts
@@ -21,11 +21,11 @@ export class FacebookSignInPage extends Page {
}
public async signInAsJonSnow() {
- await this.signInAs('[email protected]', 'jon_qvfhyum_snow');
+ await this.signInAs('[email protected]', 'jon_jdrtrsd_snow');
}
public async signInAsAryaStark() {
- await this.signInAs('[email protected]', 'arya_mdmwgdg_stark');
+ await this.signInAs('[email protected]', 'arya_xittsrj_stark');
}
public async signInAs(email: string, password: string) {
diff --git a/tests/pages/ShowIdeaPage.ts b/tests/pages/ShowIdeaPage.ts
index 8d8f145ea..bc55742e1 100644
--- a/tests/pages/ShowIdeaPage.ts
+++ b/tests/pages/ShowIdeaPage.ts
@@ -11,7 +11,7 @@ export class ShowIdeaPage extends Page {
@findBy('div.description')
public Description: WebComponent;
- @findBy('.support-counter .value')
+ @findBy('.support-counter .button')
public SupportCounter: WebComponent;
public loadCondition() {
diff --git a/vendor/github.com/goenning/letteravatar/draw.go b/vendor/github.com/goenning/letteravatar/draw.go
index 16d700ee7..9a5ae9b14 100644
--- a/vendor/github.com/goenning/letteravatar/draw.go
+++ b/vendor/github.com/goenning/letteravatar/draw.go
@@ -9,6 +9,7 @@ import (
"strings"
"sync"
"time"
+ "unicode"
"unicode/utf8"
"github.com/golang/freetype"
@@ -32,11 +33,21 @@ var defaultLetterColor = color.RGBA{0xf0, 0xf0, 0xf0, 0xf0}
// Extract two letters from given name
func Extract(name string) string {
- slices := strings.FieldsFunc(name, split)
+ name = strings.Trim(name, " ")
+ if name == "" {
+ return "?"
+ }
+
+ slices := splitBySpace(name)
+ if len(slices) < 2 {
+ slices = splitByCamelCase(name)
+ }
+
if len(slices) >= 2 {
- return first(slices[0]) + first(slices[1])
+ return strings.ToUpper(first(slices[0]) + first(slices[1]))
}
- return first(name)
+
+ return strings.ToUpper(first(name))
}
func first(s string) string {
@@ -44,8 +55,55 @@ func first(s string) string {
return string(firstLetter)
}
-func split(r rune) bool {
- return r == '.' || r == ',' || r == ' '
+func splitBySpace(src string) (entries []string) {
+ return strings.FieldsFunc(src, func(r rune) bool {
+ return r == '.' || r == ',' || r == ' '
+ })
+}
+
+func splitByCamelCase(src string) (entries []string) {
+ // don't split invalid utf8
+ if !utf8.ValidString(src) {
+ return []string{src}
+ }
+ entries = []string{}
+ var runes [][]rune
+ lastClass := 0
+ class := 0
+ // split into fields based on class of unicode character
+ for _, r := range src {
+ switch true {
+ case unicode.IsLower(r):
+ class = 1
+ case unicode.IsUpper(r):
+ class = 2
+ case unicode.IsDigit(r):
+ class = 3
+ default:
+ class = 4
+ }
+ if class == lastClass {
+ runes[len(runes)-1] = append(runes[len(runes)-1], r)
+ } else {
+ runes = append(runes, []rune{r})
+ }
+ lastClass = class
+ }
+ // handle upper case -> lower case sequences, e.g.
+ // "PDFL", "oader" -> "PDF", "Loader"
+ for i := 0; i < len(runes)-1; i++ {
+ if unicode.IsUpper(runes[i][0]) && unicode.IsLower(runes[i+1][0]) {
+ runes[i+1] = append([]rune{runes[i][len(runes[i])-1]}, runes[i+1]...)
+ runes[i] = runes[i][:len(runes[i])-1]
+ }
+ }
+ // construct []string from results
+ for _, s := range runes {
+ if len(s) > 0 {
+ entries = append(entries, string(s))
+ }
+ }
+ return
}
// Draw generates a new letter-avatar image of the given size using the given letter
diff --git a/vendor/github.com/goenning/letteravatar/draw_test.go b/vendor/github.com/goenning/letteravatar/draw_test.go
new file mode 100644
index 000000000..e484283ae
--- /dev/null
+++ b/vendor/github.com/goenning/letteravatar/draw_test.go
@@ -0,0 +1,62 @@
+package letteravatar_test
+
+import (
+ "testing"
+
+ "github.com/goenning/letteravatar"
+)
+
+func TestExtract(t *testing.T) {
+ testCases := []struct {
+ input string
+ expected string
+ }{
+ {
+ input: "Jon Snow",
+ expected: "JS",
+ },
+ {
+ input: "jon.snow",
+ expected: "JS",
+ },
+ {
+ input: "Jon Snow Start",
+ expected: "JS",
+ },
+ {
+ input: "Arya stark",
+ expected: "AS",
+ },
+ {
+ input: " Arya stark ",
+ expected: "AS",
+ },
+ {
+ input: "Arya",
+ expected: "A",
+ },
+ {
+ input: "Arya99",
+ expected: "A9",
+ },
+ {
+ input: "J",
+ expected: "J",
+ },
+ {
+ input: "",
+ expected: "?",
+ },
+ {
+ input: "AryaStark",
+ expected: "AS",
+ },
+ }
+
+ for _, testCase := range testCases {
+ output := letteravatar.Extract(testCase.input)
+ if output != testCase.expected {
+ t.Errorf("[%s]: %s != %s ", testCase.input, output, testCase.expected)
+ }
+ }
+}