forked from amzn/style-dictionary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Jest testing (amzn#133) * moved all the existing tests to Jest * finalised Jest tests for “utils” removing assert dependency * finalised Jest tests for “register” removing assert dependency + moved tests under correct folder * finalised Jest tests for “transform” removing assert dependency + moved tests under correct folder + removed extra file * updated path for “service” files/folders * removed output folder * updated the paths to ignore in the Jest config in package.json * finalised Jest tests for “clean” removing assert dependency + other small changes * added “__output” to the list of folders ignored by Jest * some tunings + more tests * more tests cleanup * fixed test for exportPlatform * fixed last tests, and now all tests are green! * Added first snapshot tests! Yay! * added mock for dates to avoid failing snapshots tests * updated tests * first attempt to fix the UTC date problem on CI (reference: boblauer/MockDate#9) * second attempt to fix the UTC date problem on CI * removed the TZ=UTC env environment to test if is really needed * updated all the occurrences of new Date in the templates * restored linting before running the tests suite * code style fix * fixed wrong porting of the test for buildAllPlatforms * test(all): Fix for all tests to match the date and remove of mockdate (amzn#148) inspiration jestjs/jest#2234 * test(javascript/es6): Add test for es6 (amzn#149) * test: add registerTemplate (amzn#147) * add tests for transform object (amzn#151) * add tests for transform object * split up complex test in multiple smaller tests * Jest flatten props (amzn#163) * Adding tests for lib/utils/flattenProperties.js (amzn#146) * Adding tests for lib/utils/flattenProperties.js * update to use lodash sortby function * update to use lodash sortby function * Add babel-jest (amzn#173)
- Loading branch information
1 parent
aa19668
commit 15c876d
Showing
119 changed files
with
10,938 additions
and
6,096 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["env"] | ||
} |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"asset": { | ||
"font": { | ||
"icon": { | ||
"value": "./test/__assets/fonts/scapp_icons-regular.ttf" | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"asset": { | ||
"image": { | ||
"flag": { | ||
"us": { | ||
"mdpi": { | ||
"value": "__tests__/__assets/images/mdpi/flag_us_base.png" | ||
}, | ||
"hdpi": { | ||
"value": "__tests__/__assets/images/hdpi/flag_us_base.png" | ||
}, | ||
"xhdpi": { | ||
"value": "__tests__/__assets/images/xhdpi/flag_us_base.png" | ||
}, | ||
"xxhdpi": { | ||
"value": "__tests__/__assets/images/xxhdpi/flag_us_base.png" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
* the License. A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
var helpers = require('./__helpers'); | ||
var StyleDictionary = require('../index'); | ||
|
||
describe('buildAllPlatforms', () => { | ||
|
||
beforeEach(() => { | ||
helpers.clearOutput(); | ||
}); | ||
|
||
afterEach(() => { | ||
helpers.clearOutput(); | ||
}); | ||
|
||
it('should work with json config', () => { | ||
var StyleDictionaryExtended = StyleDictionary.extend(__dirname + '/__configs/test.json'); | ||
StyleDictionaryExtended.buildAllPlatforms(); | ||
expect(helpers.fileExists('./__tests__/__output/web/_icons.css')).toBeTruthy(); | ||
expect(helpers.fileExists('./__tests__/__output/android/colors.xml')).toBeTruthy(); | ||
}); | ||
|
||
it('should work with js config', () => { | ||
var StyleDictionaryExtended = StyleDictionary.extend(__dirname + '/__configs/test.js'); | ||
StyleDictionaryExtended.buildAllPlatforms(); | ||
expect(helpers.fileExists('./__tests__/__output/web/_icons.css')).toBeTruthy(); | ||
expect(helpers.fileExists('./__tests__/__output/android/colors.xml')).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
* the License. A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
var buildFile = require('../lib/buildFile'); | ||
var helpers = require('./__helpers'); | ||
|
||
function format() { | ||
return "hi"; | ||
} | ||
|
||
describe('buildFile', () => { | ||
|
||
beforeEach(() => { | ||
helpers.clearOutput(); | ||
}); | ||
|
||
afterEach(() => { | ||
helpers.clearOutput(); | ||
}); | ||
|
||
it('should error if format doesnt exist or isnt a function', () => { | ||
expect( | ||
buildFile.bind(null, '__tests__/__output/test.txt', {}, {}, {}) | ||
).toThrow('Please enter a valid file format'); | ||
expect( | ||
buildFile.bind(null, '__tests__/__output/test.txt', [], {}, {}) | ||
).toThrow('Please enter a valid file format'); | ||
expect( | ||
buildFile.bind(null, '__tests__/__output/test.txt', null, {}, {}) | ||
).toThrow('Please enter a valid file format'); | ||
}); | ||
|
||
it('should error if destination doesnt exist or isnt a string', () => { | ||
expect( | ||
buildFile.bind(null, {}, format, {}, {}) | ||
).toThrow('Please enter a valid destination'); | ||
expect( | ||
buildFile.bind(null, [], format, {}, {}) | ||
).toThrow('Please enter a valid destination'); | ||
expect( | ||
buildFile.bind(null, null, format, {}, {}) | ||
).toThrow('Please enter a valid destination'); | ||
}); | ||
|
||
it('should write to a file properly', () => { | ||
buildFile('test.txt', format, {buildPath: '__tests__/__output/'}, {}); | ||
expect(helpers.fileExists('./__tests__/__output/test.txt')).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.